Configure WAS for DB2 access

This topic describes how to configure V6 on a Linux or UNIX-based platform to use multiple V8.1 DB2 clients.

 

Before you begin

WebSphere Application Server, V6 does not configure environment variables for accessing a DB2 database during installation. A database is not a prerequisite. Therefore, the installation and configuration of V6 do not involve database configuration.

You can install multiple DB2 Version 8.x instances on the same Linux or UNIX machine. This topic describes configuring V6 on a Linux or UNIX-based platform to use multiple V8.x DB2 clients.

See the IBM WAS supported hardware, software, and APIs Web site at http://www.ibm.com/software/webservers/appserv/doc/latest/prereq.html for information about required patches for DB2.

 

Overview

If your WebSphere Application Server, V6 machine has only a V8.x client installed, and all DB2 data sources defined in WAS access DB2 databases through this client, source the db2profile file in the login profile of your V6 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:

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

 

Procedure

  1. Update the .profile of user adm0001.

    Add the following line

    . /export/home/db2inst1/sqllib/db2profile
    

    You can also add the line to the setupCmdLine.sh 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 administrative console:

    • Leave the default value (${DB2_JDBC_DRIVER_PATH}/db2java.zip) 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/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-required environment variables for a particular Application Server.

    1. On the administrative console of WebSphere Application Server, click Application servers > servername > Configuration > Java and process management > Environment entries > New to create a new entry.

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

    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/db2v8/sqllib//lib for a V8.x client, or /export/home/db2v8B/sqllib/lib for another V8.x 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 product so that it can use both V8.1 clients.

    In cases where multiple V8.1 clients are installed on a WAS V5.x machine, and you intend to use two or more clients in your V6 Application Servers, one can set DB2 environment variables within 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 (on a WAS V5.x machine) and a V8 server (on a WAS V6 machine), use the DB2 V7 client on the WAS V5.x machine to access both the V7 server and the V8 DB2 server.

    WebSphere Application Server V6 supports DB2 V8.x but does not support V7.

    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.

    When you use a V7 client (on a WebSphere Application Server V5.x machine) 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 runtime 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 one cannot have one application server instance communicating with both a V7 client and a V8.1 client. However, one 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.

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

 

Result

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

 

What to do next

Return to Task overview: Installing to continue.


 



 

 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.
IBM is a trademark of the IBM Corporation in the United States, other countries, or both.