[V5.1 and later]Configuring WebSphere Application Server for DB2 access

 

Overview

This topic describes configuring WAS V5.x on a Linux or UNIX-based platform to use multiple DB2 clients, including a V7 client and a V8.1 client.

For compatability with IBM Developer Kit for Java 1.4.1, upgrade DB2 client and server nodes to:

A DB2 client at V8.1 with Fix Pack 3 can connect to a V7.2 database server, but not for XA.

 

Procedure

  1. If all DB2 data sources defined in WAS access DB2 databases through V7 and V8.1 clients, source the db2profile file in the login profile of the WAS V5.x instance owner.

    For example, assume that the following values are true:

    WAS instance owner adm00001
    DB2 client instance owner db2inst1
    DB2 client instance home /export/home/db2inst1

    Update the .profile of user adm0001 with...

    . /export/home/db2inst1/sqllib/db2profile

    You can also add the line to the setupCmdLine.sh script of WAS.

    To use the JDBC2 drivers instead of the default JDBC1 drivers, and to put the DB2 lib directory in the java.library.path variable, invoke the script...

    $DB2_HOME/java12/usejdbc2

  2. Specify the JDBC provider class path using the DB2 JDBC Provider definition panel of the WAS admin console. The preferred method is to leave the default value.

    ${DB2_JDBC_DRIVER_PATH}/db2java.zip

    Go to...

    Environment | Manage WebSphere Variables

    and set DB2_JDBC_DRIVER_PATH to...

    /export/home/db2inst1/sqllib/java12

    The other way is to enter the absolute class path, for example...

    /export/home/db2inst1/sqllib/java12/db2java.zip

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

  3. Set Db2 instance and library path variables....

    1. On the WAS admin console of WAS, go to...

      Application Servers | server | Configuration | Additional Properties | Process Definition | Additional Properties | Environment Entries | New

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

    3. Create a library path entry, depending on your OS...

      AIX: LIBPATH
      Linux: LD_LIBRARY_PATH
      Solaris: LD_LIBRARY_PATH
      HP-UX: SHLIB_PATH

      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 db2jdbc.so 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 V5.x product to use both DB2 V7 and V8.1 clients.

    In cases where both a DB2 V7 client and a V8.1 client are installed on a WAS V5.0.x machine, or multiple V8.1 clients are installed on a WAS V5.0.x or V5.1.x machine, and you intend to use two or more clients in your WAS V5.x 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 client 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, you must 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 Java virtual machine (JVM). Each JVM can have its own set of environment variables that differ from other Application Server instances.

    You can 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 server1 Application Server instance to run in the DB2 V7 client instance, server1 application components can use only data sources defined under the same V7 client JDBC driver.

    WAS V5.x 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.


Related tasks
Configuring WebSphere Application Server after migration