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
- In the Administrative Console, select the Types
view.
- Right-click JDBCDrivers.
- From the pop-up menu, select Create.
- 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.
- Click Create.
Step Two: Define the DataSource
- In the Types view, right-click DataSources.
- From the pop-up menu, select Create.
- 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.
- Optionally you can use the Advanced tab to specify
pooling parameters for the DataSource, or just accept the defaults.
- Click Create.
Step Three: Install
your driver
- In the Administrative Console, select the Topology
view
- Expand the WebSphere Admin Domain tree
- Locate and right-click the driver you created in
step one.
- From the pop-up menu, select Install.
- 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).
- Click Install.
|