This topic applies only on the z/OS operating system.

Using a DB2 for z/OS Local JDBC Provider (RRS) with WebSphere Application Server for z/OS

To use a JDBC provider for DB2 for z/OS with a data source for WebSphere Application Server for z/OS, you need to perform configuration steps that allow interaction between the two environments.

About this task

Setting up a JDBC provider for DB2 for z/OS and creation of a data source in WebSphere Application Server for z/OS is complicated by the fact that the JDBC driver must locate and load the DSNJDBC_JDBCProfile.ser file. DB2 for z/OS Version 7 has enhanced the mechanism by which the JDBC driver locates and loads this file to accommodate WebSphere Application Server for z/OS.

Procedure

  1. Optional: Update the PROCs for the servant address spaces to include the DB2 libraries.

    Installations have the option of placing the DB2 libraries in the linklist or //STEPLIB DD concatenation for the WebSphere address spaces that will use JDBC. In some installations a combination of techniques are used. If your installation does not have SDSNEXIT, SDSNLOAD and SDSNLOD2 in the linklist, then you must update the //STEPLIB DD concatenation for the servant address space with the missing libraries.

    Consider the following example:

    The system on which WebSphere for z/OS Version 5 is active has multiple DB2 subsystems of different versions. There are the JUDY and DBP3 subsystems, where DBP3 is the default DB2 subsystem from a linklist perspective. The p5serv1 server uses the JUDY subsystem, hence the servant address space associated with the p5srv1 server must specify the appropriate DB2 libraries in the //STEPLIB DD concatenation.

    On this system, the servant address space uses procedure P5NCASR, which includes member P5NCASRZ, which contains the //STEPLIB DD concatenation. The last three lines in the following are the updates, in gray area, which that were made for JDBC access to the JUDY subsystem.
     //* P5NCASRZ
    //*
    //* Output DDs
    //*
    //CEEDUMP DD SYSOUT=*
    //SYSOUT DD SYSOUT=*
    //SYSPRINT DD SYSOUT=*
    //*
    //*Steplib Setup
    //*
    //STEPLIB DD DISP=SHR,DSN=WAS500.WAS.SBBOLD2
    // DD DISP=SHR,DSN=WAS500.WAS.SBBOLOAD
    // DD DISP=SHR,DSN=DSN710.JUDY.SDSNEXIT
    // DD DISP=SHR,DSN=DSN710.SDSNLOAD
    // DD DISP=SHR,DSN=DSN710.SDSNLOD2
    //*
  2. Create/update the db2sqljjdbc.properties file to indicate the location of the DSNJDBC_JDBCProfile.ser file.

    The db2sqljjdbc.properties file contains information which the DB2 JDBC driver uses to configure itself. The following are the contents of the db2sqljjdbc.properties file created for the use of the WebSphere servers running in node nodec of cell p5cell and in particular server p5srv1.

    The area near the bottom under db2.connpool.max.size=100 indicates the new means by which the location of the DSNJDBC_JDBCProfile.ser file is specified using as of APAR PQ69861.
    # >>> Start of p5nc_wscjudy_db2sqljjdbc.properties <<<
    #
    # Any lines starting with the pound sign '#'
    # are comments. Please see the DB2 for OS/390
    # Application Programming Guide and Reference
    # for Java for the description of these settings.
    #
    #
    # This DBRMLIB is specific for the DSN7 subsystem and the JDBC driver.
    #
    #DB2SQLJDBRMLIB=DSN710.DBRMLIB.DATA
    #
    # This is installation specific: the name of the DB2 subsystem to use.
    #
    DB2SQLJSSID=JUDY
    #
    # The next 5 items are default values which are coded for documentation
    #
    #
    DB2SQLJPLANNAME=DSNJDBC
    DB2SQLJJDBCPROGRAM=DSNJDBC
    DB2SQLJMULTICONTEXT=YES
    DB2SQLJATTACHTYPE=RRSAF
    DB2CURSORHOLD=YES
    #
    #
    # The following items are for tracing, there are no default values
    #
    #DB2SQLJ_TRACE_FILENAME=/tmp/p5srv1_jdbc
    #DB2SQLJ_TRACE_BUFFSIZE=256
    #DB2SQLJ_TRACE_WRAP=1
    #
    #
    db2.connpool.max.size=100
    #
    # The following allows the JDBC driver to find and
    # load the serialized profile.
    #
    db2.jdbc.profile.pathname=/usr/lpp/db2710/classes/DSNJDBC_JDBCProfile.ser
    #
    # <<< End of p5nc_wscjudy_db2sqljjdbc.properties >>>
    The key entries in this file are:
    DB2SQLJSSID
    Identifies the DB2 subsystem (for example, JUDY) that should be used by the JDBC driver
    db2.jdbc.profile.pathname
    Identifies the serialized profile (for example, /usr/lpp/db2710/classes/DNSJDBC_JDBCProfile.ser) to be used by the JDBC dsriver. This is a new property introduced by APAR PQ69861.
    Note: WebSphere for z/OS has always recommended specifying the db2sqljjdbc.properties and contents rather than assuming the defaults. While it is possible for the JDBC driver to locate the DB2 subsystem through specifying SSID in the DSNHDECP module, which resides in SDSNEXT library, rather than db2sqljjdbc.properties file, it is useful having a properties file for several reasons. Being able to specify the location of the serialized profile makes the definition of the DB2 JDBC provider less complicated.
    Note: This file must be placed in the HFS in a directory that is readable by the all the servant address spaces on the z/OS image. It must be in codepage Cp1047 (for example, EBCDIC).
  3. Create/update WebSphere environment variables so the WebSphere server can locate the DB2 home directory and the JDBC driver can locate the db2sqljjdbc.properties file.

    The WebSphere for z/OS configuration needs to have WebSphere and POSIX environment variables set so that the DB2 home directory and the db2sqljjdbc.properties file can be located. Click on Environment > Manage WebSphere Variables. Select the node level view and click Apply.

    There are two variables of interest.
    1. DB2390_JDBC_DRIVER_PATH This variable will be present but have no assigned value. Update this value to the directory in which the DB2 code resides. For example: /usr/lpp/db2/db2710
    2. DB2SQLJPROPERTIES This variable will not be present. Add this value to indicate the location and name of DB2 JDBCSQLJ properties file which you created for this node. For example: /shared/zWebSphere/V5/misc/p5nc_wscjudy_db2sqljjdbc.properties
    Note: These variables are set at the node level and thus are applicable to all servers in the node residing on this system. They can be set at the server level instead of or in addition to setting them at the node level.
    Note: The DB2390_JDBC_DRIVER_PATH variable could actually be set at the cell level and removed from the node level definitions if all nodes in the cell will use the same DB2 home directory.
    Note: The DB2SQLJPROPERTIES should not be set at the cell level, as it contains the specific DB2 subsystem to which the JDBC driver will use.
    Note: The /shared/zWebSphere/V5/misc/ directory is a commonly accessible directory for all systems in the sysplex. The name of the file indicates which cell (for example, p5) and node (for example, nc) that it is intended to be used. It is certainly possible to use a non-shared directory that is system specific (for example, /etc/zWebSphere/V5/misc/...)
    Note: After these updates have been made and saved, it is necessary to restart the server to have the server use the //STEPLIB DD updates from Step 1, if required, and to have the POSIX runtime environment variables refreshed with the changes made in this step. This restart can be delayed, but it must be done before the data source created in the last step can be used.
  4. Define J2C Authentication Aliases to provide userid with password to be used when connecting to DB2k.

    If you do not want to connect to DB2 with the servant region's userid, you must define an alias that holds a userid and password to be used on the getConnection( ) method. Click on Security > Configuration > J2C Authentication Data.

    Click New and specify an alias, a userid and a password that can be passed to DB2 (or any other J2C resource), then click Apply.

    Note: Add as many aliases as you require for access to DB2.
  5. Define the DB2 for z/OS Local JDBC Provider (RRS) for data access.

    From the administrative console, click Resources > JDBC Providers. Select the server on which you want to install a JDBC provider and click Apply.

    Click New. In the list of JDBC providers, select DB2 390 Local JDBC Provider (RRS), then click Apply.

  6. Define a data source. Select Data source to create a data source for a J2EE 1.3 compliant application. (If your application adheres to the J2EE 1.2 specification, select Data source Version 4.
    Click New. Define data source properties that are required for use of the Legacy DB2 for OS/390 and z/OS JDBC driver:
    • A Name
    • A JNDI name
    • The database name, which is the location of the DB2 subsystem that manages the data you want to access
    • A Component-managed Authentication Alias (optional) for connection authentication
    • A Container-managed Authentication Alias (optional) for connection authentication

    Indicate if you want this data source to be used for container-managed persistence, then click Apply. Save all of your changes to the master configuration.

    Optional: Configure custom properties. Like the required properties, custom properties for the Legacy DB2 for OS/390 and z/OS JDBC driver must be set on the data source. Learn about these properties in the Application Programming Guide and Reference for Java for your version of DB2 for z/OS.

What to do next

Now you are ready to install an application and test your data source.



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Sep 20, 2010 10:03:57 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=vela&product=was-nd-zos&topic=jdbcdb2zos
File name: tdat_jdbcdb2zos.html