Configuring for the Connection Pooling Sample

Before you can run the connection pooling sample (ConnPoolTest servlet), you must set up the IBM DB2 SAMPLE database and create a userid and password for it. If you haven't done this yet for the other WebSphere samples, refer to Configuring the Samples.

Next, follow these instructions to create a DataSource object for the DB2 SAMPLE database, using the WebSphere Application Server Administrative Console.

Step One: Create a JDBC Driver

  1. In the Administrative Console, select the Types view.
  2. Right-click JDBCDrivers.
  3. From the pop-up menu, select Create.
  4. Use these values in the subsequent dialog:
    Name: Enter an arbitrary name for the driver, such as DB2JDBCDriver
    Implementation class: com.ibm.db2.jdbc.app.DB2Driver
    URL prefix: Enter jdbc:db2 for DB2 5.2. Enter jdbc:db2 for DB2 6.1 without JTA enabled, or jdbc:jta:db2 for DB2 6.1 with JTA enabled.
    JTA Enabled: Select false for DB2 5.2. If the URL prefix is jdbc:db2, select false for DB2 6.1. If the URL prefix is jdbc:jta:db2, select true for DB2 6.1. Note how you need to coordinate the entires for URL prefix and JTA Enabled if you are using DB2 6.1.
  5. Click Create.

Step Two: Define the DataSource

  1. In the Types view, right-click DataSources.
  2. From the pop-up menu, select Create.
  3. Use these values in the subsequent dialog:
    Name: Enter sample. (The DataSource will be stored in the jdbc/sample directory. In the ConnPoolTest servlet, we use this directory as the JNDI lookup name to locate this DataSource object as specified in its properties file, ConnPoolTestStrings.properties.)
    Database name: Enter SAMPLE which is the actual name of the database. (This points your DataSource to jdbc:db2:SAMPLE.)
    Driver: Enter the JDBC driver you created in step one, probably DB2JDBCDriver.
  4. Optionally you can use the Advanced tab to specify pooling parameters for the DataSource, or just accept the defaults.
  5. Click Create.

Step Three: Install your driver

  1. In the Administrative Console, select the Topology view
  2. Expand the WebSphere Admin Domain tree
  3. Locate and right-click the driver you created in step one.
  4. From the pop-up menu, select Install.
  5. In the subsequent dialog:
    Select the node on which to install the driver
    Click Browse to find db2java.zip (This is the file containing the driver).
  6. Click Install.