Create and Load a SQL Server Database

Create a SQL Server database and define a database connection.

Create the PUBS SQL Server Database

Using SQL Server Management Studio, create a new SQL Server database, PUBS, on your local default instance of SQL Server, and configure it to use SQL Server authentication by providing a user ID and password. See your SQL Server documentation for instructions.

Start Visual COBOL

If you have closed Visual COBOL since completing Tutorial: Reusing Existing COBOL Programs in a Java Environment, open it again; then open the Java EE perspective and the Project Explorer.

Catalog a JDBC Connection in JBoss

Now that the JDBC driver is available for JBoss, you must catalog a connection that uses the driver, providing a DSN for the connection that you specify in an EXEC SQL CONNECT statement:

  1. Using any text editor, edit the standalone.xml located in your JBoss installation's standalone\configuration directory.
  2. In the editor, locate the following set of tags:
    <subsystem xmlns="urn:jboss:domain:datasources:1.0">
        <datasources>
  3. To define a JDBC connection named pubs, add the following code just below <datasources>, replacing SQLServerUserName and SQLServerPassword respectively with the user name and password required for SQL Server authentication:
    <datasource jndi-name="java:/pubs" pool-name="pubs-Pool">
         <connection-url>jdbc:sqlserver://localhost:1433;databaseName=Pubs</connection-url>
         <driver>sqlserver</driver>
         <pool>
              <min-pool-size>10</min-pool-size>
              <max-pool-size>10</max-pool-size>
              <prefill>true</prefill>
         </pool>
         <security>
              <user-name>SQLServerUserName</user-name>
              <password>SQLServerPassword</password>
         </security>
    </datasource>
  4. Locate the <drivers> tag just before the closing </datasources> tag.
  5. Just below the <drivers> tag, add the following:
    <driver name="sqlserver" module="com.microsoft.sqlserver"/>
  6. Save and close the file.