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