Auto-configuring a Db2 type 2 connection
Create a CICS®-aware Db2® DataSource with type 2
connectivity by using the auto-configure property. This uses the jdbc-4.0,
jdbc-4.1, jdbc-4.2, or jdbc-4.3
feature.
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 -
If the default schema is not the current userid, set the
Ddb2.jcc.currentSchema in the JVM profile to the name of the schema.
For example:
-db2.jcc.currentSchema=CICSDB2 - Install and enable the JVMSERVER resource.
Results
<featureManager>
...
<feature>jdbc-4.2</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>