Auto-configuring a Db2
DataSource with type 2 connectivity through CICS using the
jdbc-4.0 or jdbc-4.1 feature
Create a CICS®-aware Db2® DataSource with type 2
connectivity by using the auto-configure property. This uses 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 Db2 DataSource with type 2 connectivity in the Liberty server.xml, which operates through the CICS DB2CONN, by using the JVM profile auto-configure property. The JNDI name is jdbc/defaultCICSDataSource.
If there is already a 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 Db2 DataSource with type 2 connectivity through CICS using the jdbc-4.0 or jdbc-4.1 feature.
Procedure
- Enable auto-configure by setting -Dcom.ibm.cics.jvmserver.wlp.autoconfigure=true in the JVM profile.
-
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 - Install and enable the JVMSERVER resource.
Results
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>