Accessing Db2 for z/OS databases from JMP or JBP applications
A JMP or JBP application can access Db2 for z/OS using the latest JDBC driver for Db2 for z/OS.
Attention: If you access a Db2 for z/OS database using both Java™ and COBOL in the same application, you might experience unexpected
behavior, but only if the commit or rollback processing is done in COBOL while active cursors are in
the Java portion.
The JMP or JBP region that the application is running in can also be defined with Db2 for z/OS attached by the DB2® Recoverable Resource Manager Services attachment facility (RRSAF).
Accessing Db2 for z/OS data from a JMP or JBP application is like accessing IMS data. When writing a JMP or JBP application that accesses Db2 for z/OS data, consider both the differences from IMS database access and the differences from accessing Db2 for z/OS data in other environments:
- You must create a DB2 plan for each PSB (typically each Java application) that is used to access Db2 for z/OS.
- You can have only one active Db2 for z/OS connection open at any time.
- If you are using the type-2 JDBC drivers for Db2 for z/OS, you must use the default connection
URL in the application program. For example,
jdbc:db2os390:ordb2:default:connection. - If you are using the type-4 DB2 JDBC drivers, you can use a specific connection URL in the application program.
- To commit or roll back work, use the Transaction.commit method
or the Transaction.rollback method.
- For JMP applications, the Transaction.commit method commits all work, including SQL calls. Calling the Transaction.commit and Transaction.rollback methods does not automatically reset the connection to Db2 for z/OS. The connection to Db2 for z/OS is reset when you issue a MessageQueue.getUnique call.
- For JBP applications, the Transaction.commit method commits SQL calls.
- Because RRSAF is the coordinator, you cannot use the Connection.setAutoCommit or Connection.commit method of the JDBC driver for Db2 for z/OS.