Accessing data from CICS applications written in Java

CICS® applications written in Java™ can use a variety of methods to access data. The methods available depend on the type of data to be accessed.

Accessing relational data
To access relational data, a CICS application written in Java can use any of the following methods:
  • A JCICS LINK command, or the CCI Connector for CICS TS, to link to a program that uses Structured Query Language (SQL) commands to access the data. For information about using the CCI Connector for CICS TS, see The CCI Connector for CICS TS.
  • Where a suitable driver is available, use Java Data Base Connectivity (JDBC) or Structured Query Language for Java (SQLJ) calls to access the data directly. Suitable JDBC drivers are available for DB2®. TheCICS DB2 Guide tells you how to use the JDBC and SQLJ application programming interfaces and the DB2-supplied JDBC drivers to access data held in a DB2 database.
    Note: To use JDBC or SQLJ from a Java program or enterprise bean with a Java 2 security policy mechanism active, you must use the JDBC 2.0 driver provided by DB2 Version 7. The JDBC 1.2 driver provided by DB2 does not support Java 2 security, and will fail with a security exception. CICS DB2 Guide tells you how to grant permissions to the JDBC driver in your Java 2 security policy.
  • Data Access beans developed using Visual Age for Java. Data Access beans give you a fast, easy, non-programming way of building SQL queries. They might have a higher overhead than plain JDBC or SQLJ calls, as you cannot tailor them so precisely for your application. However, if you are not experienced in JDBC or SQLJ programming, Data Access beans reduce application development time and are more convenient to use. Data Access beans are described in Using Data Access beans.
  • JavaBeans that use JDBC or SQLJ as the underlying access mechanism. You can use any suitable Java integrated development environment (IDE) to develop such JavaBeans.
  • Entity beans. CICS does not support entity beans running under CICS but does support access to entity beans running on other EJB servers. A CICS enterprise bean could, for example, use an entity bean running on WebSphere® Application Server to access DB2 on z/OS.
Accessing DL/I data

To access DLI data, a CICS application written in Java can use a JCICS LINK command, or the CCI Connector for CICS TS, to link to a program that issues EXEC DLI commands to access the data. For information about using the CCI Connector for CICS TS, see The CCI Connector for CICS TS.

Accessing VSAM data
To access VSAM data, a CICS application written in Java can use either of the following methods:
  • Use a JCICS LINK command, or the CCI Connector for CICS TS, to link to a program that issues CICS File Control commands to access the data. For information about using the CCI Connector for CICS TS, see The CCI Connector for CICS TS.
  • Use the JCICS File Control classes to access VSAM directly.
Note:
  1. All the above techniques can be used by both CICS enterprise beans and CICS Java programs.
  2. The same data can be accessed by CICS enterprise beans, CICS Java programs, and (excluding CICS VSAM data) by non-CICS entity beans.
  3. For all the above techniques except the use of entity beans, data integrity is maintained by the CICS recovery manager. When entity beans are used, you can use CICS and, for example, WebSphere Application Server's global transactional support, to maintain data integrity.
  4. You can encapsulate JCICS commands in a JavaBean. This makes it easier to program the enterprise beans that use JCICS to access data.