Manually configuring a DB2 DataSource or the DriverManager interface with type 2 connectivity through CICS using the cicsts:jdbc-1.0 feature

A CICS® Liberty JVM server can be configured to use JDBC type 2 connectivity through CICS, providing Java applications with either a javax.sql.DataSource or a java.sql.DriverManager interface to access DB2® databases.

Before you begin

Configure your CICS region to connect to DB2. For more information, see Defining the CICS DB2 connection.

About this task

Although you can configure CICS Liberty to access DB2 with type 2 connectivity using the cicsts:jdbc-1.0 feature, the preferred method is to use the Liberty jdbc-4.x features. For more information, see Manually configuring a DB2 DataSource with type 2 connectivity through CICS using the jdbc-4.0 or jdbc-4.1 feature. However, if you want to use the DriverManager interface, you must use the cicsts:jdbc-1.0 feature as described in the following procedure.

Procedure

  1. Add the cicsts:jdbc-1.0 feature to the featureManager element.
    This enables use of the cicsts_jdbcDriver and cicsts_dataSource elements, used later in the server.xml file.
    <featureManager>
        <feature>cicsts:jdbc-1.0</feature>
    </featureManager>
  2. Add a cicsts_jdbcDriver element. This enables JDBC type 2 connectivity with the java.sql.DriverManager or javax.sql.DataSource interface.
    The cicsts_jdbcDriver element must refer to a library definition that specifies the library from which the JDBC driver components (the DB2 JDBC jar and native dll files) are to be loaded. Typical definitions might look like this:
    <cicsts_jdbcDriver libraryRef="defaultCICSDb2Library"/>
    <library id="defaultCICSDb2Library">
        <fileset dir="/usr/lpp/db2v11/jdbc/classes" includes="db2jcc4.jar db2jcc_license_cisuz.jar"/>
        <fileset dir="/usr/lpp/db2v11/jdbc/lib" includes="libdb2jcct2zos4_64.so"/>
    </library>
    Note: Only one cicsts_jdbcDriver element is required. If more than one is specified, only the last cicsts_jdbcDriver element in the server.xml file is used and the others are ignored.

If you require only java.sql.DriverManager support, then the preceding steps are sufficient.

  1. To access DB2 using the DataSource interface, a cicsts_dataSource element is required, but the preferred method for DataSource access is to use the Liberty jdbc-4.x features, as described in Manually configuring a DB2 DataSource with type 2 connectivity through CICS using the jdbc-4.0 or jdbc-4.1 feature. A cicsts_dataSource requires a jndiName attribute to define the JNDI name that is referenced by your application. A definition might look like this:
    <cicsts_dataSource id="defaultCICSDataSource" jndiName="jdbc/defaultCICSDataSource"/>
    
    Tip: The DataSource class that is used is com.ibm.db2.jcc.DB2SimpleDataSource, which implements javax.sql.DataSource.
  2. Optional: You can set attributes for the cicsts_dataSource by using a properties.db2.jcc element. The following example shows how to do this:
    <cicsts_dataSource id="defaultCICSDataSource" jndiName="jdbc/defaultCICSDataSource">
        <properties.db2.jcc currentSchema="DB2USER" fullyMaterializeLobData="true" />
    </cicsts_dataSource>
    Some of the attributes, which can be specified on the properties.db2.jcc element are not valid for DataSources with type 2 connectivity. If these invalid attributes are specified, they are ignored and a warning message is issued. The following attributes are not valid:
    • driverType
    • serverName
    • portNumber
    • user
    • password
    • databaseName

Results

The Liberty JVM server can connect to DB2 databases with JDBC type 2 connectivity through a CICS DB2CONN resource.
Note: Dynamic updates of the cicsts_dataSource and its components are not supported. Updating the configuration while the Liberty server is running can result in DB2 application failures. You should recycle the server to activate any changes.