InfoCenter Home >
6: Administer applications >
6.6: Tools and resources quick reference >
6.6.0: About user assistance >
6.6.0.2: Command line administration >
6.6.0.2.2: WebSphere Control Program (wscp) >
6.6.0.2.2.4: Example wscp commands, procedures, and scripts >
6.6.0.2.2.4.7: Creating and installing driversand data sources

6.6.0.2.2.4.7: Creating and installing drivers and data sources

The following example wscp commands create and install a JDBC driver and data source. A JDBC driver and data source must be configured for each brand and version of database from which application servers or enterprise applications require connections.

The script init.tcl must be loaded prior to using these commands (init.tcl initializes NODE, DB2_HOME, and other variables used here).

As with the administrative console, in wscp you must install the JDBCDriver corresponding to a DataSource before creating the DataSource. This might break existing scripts that create DataSources on JDBCDrivers that have not been installed. Such scripts receive a message with a JDBCDriverNotInstalledException:

/JDBCDriver:j2/DataSource:ds1/ cannot be used because /JDBCDriver:j2/ has not been installed on any node;  exception information was com.ibm.ejs.sm.exception.JDBCDriverNotInstalledException

wscp> JDBCDriver create /JDBCDriver:DB2Driver/ -attribute \
{{ImplClass com.ibm.db2.jdbc.app.DB2ConnectionPoolDataSource}}

# Install the JDBCDriver object

wscp> JDBCDriver install /JDBCDriver:DB2Driver/ -node $NODE \
-jarFile ${DB2_HOME}${FILE_SEPARATOR}java${FILE_SEPARATOR}db2java.zip

# Create a DataSource object

wscp> DataSource create /JDBCDriver:DB2Driver/DataSource:testDataSource/
-attribute {{ConfigProperties {{databaseName }} }}

The following example commands remove the DataSource object and uninstall the JDBCDriver object. Note that you cannot uninstall JDBCDrivers that have existing DataSources.

# Remove the DataSource object just created

wscp> DataSource remove /JDBCDriver:DB2Driver/DataSource:testDataSource/

# Uninstall the JDBCDriver object

wscp> JDBCDriver uninstall /JDBCDriver:DB2Driver/ -node $NODE

# Remove the JDBCDriver object just created

wscp> JDBCDriver remove /JDBCDriver:DB2Driver/

    Adding the Merant ConnectJDBC driver

    1. Start WebSphere Application Server and log in to the Advanced Single Server Edition administrative console.
    2. In the tree view on the left of the console, expand Resources and select JDBC Drivers.
    3. Under JDBC Drivers on the right, click New.
    4. Select the resource provider Merant ConnectJDBC Driver (Type 4) for MS SQL Server from the drop-down list, and click Next.
    5. Under Properties, do the following:
      1. Type the location of the ConnectJDBC driver jar files for the server class path. For Windows platforms, use a semicolon (;) to separate the two paths. For UNIX platforms, use a colon (:). For example, on Windows you might use
        D:\ConnectJDBC\lib\base.jar;D:\ConnectJDBC\lib\util.jar;D:\ConnectJDBC\lib\sqlserver.jar;D:\ConnectJDBC\spy\lib\spy.jar;
      2. Type a name for the driver. The name will appear on the JDBC Drivers list.
      3. Type a description (optional).
      4. For the implementation class, type
        com.merant.datadirect.jdbcx.sqlserver.SQLServerDataSource

        Merant uses the same data source class for both one phase and two phase. You can fill in a special WebSphere Application Server property later on in the configuration process to distinguish between the phases.

      5. Click OK.

      The driver you specified is added to the WebSphere Application Server JDBC Drivers list.

    6. Click Save in the top frame to save your data source configuration.
Go to previous article: 6.6.0.2.2.4.6: Importing and exporting a configuration by using XMLConfig Go to next article: 6.6.0.2.2.4.8: Creating an enterprise application

 

 
Go to previous article: 6.6.0.2.2.4.6: Importing and exporting a configuration by using XMLConfig Go to next article: 6.6.0.2.2.4.8: Creating an enterprise application