From CICS® enterprise beans, you can use the JDBC 1.2 driver,
the JDBC 2.0 driver, or the DB2 Universal JDBC Driver supplied
by DB2®. As the JDBC 2.0 driver and the DB2 Universal
JDBC Driver are downward compatible, enterprise beans that were written using
the JDBC 1.2 API can run using the newer drivers, and can benefit from performance
improvements made in those drivers.
Open transaction environment (OTE)
exploitation also benefits the performance of enterprise beans that make DB2
requests. (See Enabling CICS DB2 applications to exploit the open transaction environment
(OTE) through threadsafe programming for an full explanation of how application
programs can exploit the open transaction environment.) With DB2 Version 5
and earlier, CICS did not exploit the open transaction environment, and four
TCB switches were needed for each DB2 request made by an enterprise bean:
- A switch from the enterprise bean's TCB to the CICS QR TCB, where the
CICS DB2 task-related user exit was invoked.
- A switch to one of the TCBs managed by the task-related user exit, where
the DB2 subtask was carried out.
- A switch to return to the task-related user exit on the CICS QR TCB.
- A final switch to return to the enterprise bean on its TCB.
When CICS is connected to DB2 Version 6 or later, it exploits the open
transaction environment, and only two TCB switches are needed for each DB2
request:
- A switch from the enterprise bean's TCB to the L8 TCB, where the task-related
user exit is invoked, and on which the DB2 requests are made.
- A switch back to the enterprise bean's TCB.
When using JDBC and SQLJ in enterprise beans, bear in mind the following
considerations:
- To use JDBC, the DB2 libraries and
files required by the DB2-supplied JDBC drivers must be added to the LIBPATH
and TMPREFIX settings for the JVM profile used by the request processor program. Requirements to support Java programs in the CICS DB2 environment explains how to do this. The default request processor program
DFJIIRP (used by the CICS-supplied CIRP request processor transaction) uses
the JVM profile DFHJVMCD.
- As for all Java™ programs in the CICS environment, it is better
to use a default URL, rather than an explicit URL, when obtaining a JDBC connection
or an SQLJ connection context (see Committing a unit of work for more information).
- For enterprise beans, it is particularly important to avoid using the
autocommit property of a JDBC connection. Autocommit(true) must not be used in an enterprise bean running as part of an OTS transaction;
this causes an ASPD abend, because it causes a CICS syncpoint to be taken,
which is not allowed in an OTS transaction. For the same reason, do not use
EXEC CICS SYNCPOINT, JCICS commit, or JDBC or SQLJ commit commands in any
program or enterprise bean running as part of an OTS transaction.
- Remember that only one connection or connection context can be open at
a time. An enterprise bean using JDBC or SQLJ should close the JDBC connection
or SQLJ connection context before invoking methods on another enterprise bean
that also wishes to use JDBC or SQLJ within the same CICS transaction context.
Using a default URL ensures that no syncpoint is taken when the close occurs.
- DROLLBACK(YES) should not be specified on a DB2ENTRY definition or the
DB2CONN pool definition used by transactions running enterprise beans as part
of an OTS transaction. With this attribute, if a deadlock is detected, the
CICS DB2 attachment facility issues a CICS syncpoint rollback request, which
is not allowed in an OTS transaction, and an ASPD abend results. Enterprise
beans should use DROLLBACK(NO), and test for an SQLException with an SQLCODE
of --913 and issue an OTS rollback request.

[[ Contents Previous Page | Next Page Index ]]