Auto-configuring a DB2 DataSource with type 2 connectivity through CICS using the Liberty jdbc-4.0 or jdbc-4.1 features

Create a CICS® DB2® DataSource with type 2 connectivity by using the auto-configure property. This utilises the jdbc-4.0 feature if you use Java™ EE 6, or jdbc-4.1 if you use Java EE 7.

Before you begin

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

About this task

You can create a CICS DB2 DataSource with type 2 connectivity in the Liberty server.xml by using the JVM profile auto-configure property. The JNDI name is jdbc/defaultCICSDataSource.

If there is already a CICS DB2 DataSource with type 2 connectivity with id="defaultCICSDataSource", you are not able to use auto-configure to create a new one. For more information on creating one manually, see Manually configuring a CICS DB2 DataSource with type 2 connectivity for Liberty.

Procedure

  1. Enable auto-configure by setting -Dcom.ibm.cics.jvmserver.wlp.autoconfigure=true in the JVM profile.
  2. Set the com.ibm.cics.jvmserver.wlp.jdbc.driver.location in the JVM profile to the location of the DB2 JDBC library. For example -Dcom.ibm.cics.jvmserver.wlp.jdbc.driver.location=/usr/lpp/db2v11/jdbc.
  3. Install and enable the JVMSERVER resource.

Results

A CICS DB2 DataSource with type 2 connectivity is added to the Liberty server configuration file, server.xml. This example uses the jdbc-4.1 feature.
<featureManager>
    ...
    <feature>jdbc-4.1</feature>
</featureManager>
<dataSource id="defaultCICSDataSource" jndiName="jdbc/defaultCICSDataSource" transactional="false">
    <jdbcDriver libraryRef="defaultCICSDb2Library"/>
    <properties.db2.jcc driverType="2"/>
    <connectionManager agedTimeout="0"/>
</dataSource>

<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>


config_db2default_liberty.html | Timestamp icon Last updated: Sunday, 4 June 2017