Configure WAS for DB2 access

This topic describes configuring V5.1 on a Linux or UNIX-based platform to use multiple DB2 clients, including a V7 client and a V8.1 client. In WAS Version 4, environment variables required for accessing a DB2 database, such as CLASSPATH, native library path, db2instance name and so on, are included or initialized in the WAS admin.config file or in the and the command scripts. Because WAS, Version 5.1 does not store administration repository information in a relational database management system (RDBMS), a database is not a prerequisite. Therefore, the installation and configuration of V5.1 do not involve database configuration.

With the introduction of DB2 UDB Version 8.1, you can install both DB2 Version 7 and Version 8.1, or multiple DB2 Version 8.1 instances on the same Linux or UNIX machine. This topic describes configuring V5.1 on a Linux or UNIX-based platform to use multiple DB2 clients, including a V7 client and a V8.1 client.

Version 5.1 of WAS requires that you upgrade DB2 client and server nodes to DB2 V8.1.3 (Fix Pack 3) for IBM Developer Kit for Java 1.4.1 compatibility. A DB2 client at V8.1 with Fix Pack 3 can connect to a V7.2 database server, but not for XA, which some applications require. See the IBM WAS supported hardware, software, and APIs Web site at for more information. You can also open the page by clicking Prerequisites on the LaunchPad.

For more information about migrating to DB2 V8.1.3, see Migration to Version 8 at cgi-bin/ db2www/ data/ db2/ udb/ winos2unix/ support/ v8infocenter.d2w/ report?target=mainFrame&fn=c0009326.htm . (This Web address has spaces for formatting. Remove all spaces when pasting the address into a browser.)

If your WAS, Version 5.1 server machine has only a Version 7 client or a Version 8.1 client installed, and all DB2 data sources defined in WebSphere Application Server access DB2 databases through this client, source the db2profile file in the login profile of your V5.1 instance owner, invoke the script db2_home/java12/usejdbc2 to use the JDBC2 drivers instead of the default JDBC1 drivers, and put the DB2 lib directory in the java.library.path variable.

For example, assume that the following values are true:

WAS instance owner, that is the administrative user who starts WAS adm00001
DB2 client instance owner db2inst1
DB2 client instance home /export/home/db2inst1

  1. Update the .profile of user adm0001.

    Add the following line

    . /export/home/db2inst1/sqllib/db2profile

    You can also add the line to the script of WebSphere Application Server.

  2. Specify the JDBC provider class path.

    You have two ways to specify the JDBC provider class path on the DB2 JDBC Provider definition panel of the WAS administration console:

    • Leave the default value (${DB2_JDBC_DRIVER_PATH}/ as is. Click Environment > Manage WebSphere Variables in the administrative console. Set the DB2_JDBC_DRIVER_PATH variable to the value /export/home/db2inst1/sqllib/java12. This approach is preferred.

    • Enter the class path, such as /export/home/db2inst1/sqllib/java12/

    Windows platforms support only one DB2 installation. The DB2 environment variables are populated in the system environment automatically. WebSphere Application Server does not need to set these environment variables.

  3. Set DB2-required environment variables for a particular Application Server.

    1. On the administrative console of WAS, click Application Servers > server > Configuration > Additional Properties > Process Definition > Additional Properties > Environment Entries > New to create a new entry.

    2. Create a DB2INSTANCE entry. Enter DB2INSTANCE in the Name field, and the instance name, such as db2v7 in the Value field.

    3. Create a library path entry. Create the appropriate library path...

      • AIX: LIBPATH entry

      • Linux: LD_LIBRARY_PATH entry

      • Solaris: LD_LIBRARY_PATH entry

      • HP-UX: SHLIB_PATH entry

      Use the value of the DB2 native library path, such as /export/home/db2v7/sqllib/java12:/export/home/db2v7/sqllib/lib for a V7 client, or /export/home/db2v8/sqllib/lib for a V8.1 client.

      The DB2 lib directory must be on the java.library.path path. Otherwise the Application Server cannot load the library and cannot work with DB2. Even with the DB2 lib directory on the java.library.path path, invoke the /home/db2inst1/db2profile environment into the root shell before you start the Application Server.

  4. Configure the WAS product in a way that it can use both DB2 V7 and V8.1 clients.

    In cases where both a DB2 V7 client and a V8.1 client, or multiple V8.1 clients are installed on a WAS V5 machine, and you intend to use two or more clients in your V5.1 Application Servers, you can set DB2 environment variables based on each Application Server, instead of setting them globally as shown previously.

    DB2 UDB V8 uses a new client and server communications mechanism that is based on distributed relational database architecture. While the new communications mechanism provides a number of advantages, it also introduces restrictions on the communications capability between DB2 V7 and V8 products.

    Because a number of restrictions exist when using a V8 client to communicate with a V7 server, this configuration is not recommended. However, a V7 client can access a V8 server without difficulty.

    If you have a WAS application that accesses both a V7 server and a V8 server, only one V7 client is required on the Application Server instance. Use this server to access both the V7 server and the V8 server.

    You can choose to use a V7 client to access a V7 server, and use a V8 client to access a V8 server. This choice results in two versions of DB2 clients on the same WAS machine.

    When you use a V7 client to access a V8 server, explicitly bind V7 packages to the V8 server. To bind packages in the V7 client environment, make a connection to the V8 server and bind both the db2cli.lst and the db2ubind.lst files. For example

    cd /home/db2inst1/sqllib/bnd
    db2 connect to v8server
    db2 bind @db2cli.lst
    db2 bind @db2ubind.lst
    db2 terminate

    One WAS node can support multiple Application Server instances. Each Application Server is essentially a single Java run-time environment, which is one JVM. Each JVM can have its own set of environment variables that differ from other Application Server instances.

    Set DB2 environment variables per Application Server instance to let each Application Server instance communicate with a single DB2 client instance. The client instance can have multiple databases cataloged.

    Such a configuration means that you cannot have one Application Server instance communicating with both a V7 client and a V8.1 client. However, you can create another Application Server instance to communicate with a different DB2 client.

  5. Match the appropriate data source to the application component.

    When mapping a data source to an application component, do not mismatch data sources from different DB2 client instances.

    For example, if you set the server Application Server instance to run in the DB2 V7 client instance, server application components can use only data sources defined under the same V7 client JDBC driver.

    WAS V5.1 supports defining a JDBC provider on different scopes: cell, node (the default) and server. If you have different DB2 client instances, consider defining them on the server level instead of on the node level. Server level definitions avoid possible mismatches between the data sources and different DB2 JDBC providers.

You can configure DB2 for use on WAS. Tune your WAS environment as you test it. Test all redeployed applications before moving them into production.

Return to Install WAS to continue.