3.7.2 Features of connections using DB Connector for Cosminexus RM and Cosminexus RM

This subsection describes the features of connections using DB Connector for Cosminexus RM and Cosminexus RM.

Organization of this subsection
(1) Overview of processing by DB Connector for Cosminexus RM and Cosminexus RM
(2) Configuring the database connections using DB Connector for Cosminexus RM and Cosminexus RM

(1) Overview of processing by DB Connector for Cosminexus RM and Cosminexus RM

By using DB Connector for Cosminexus RM to integrate with Cosminexus RM, you can send and receive messages using the JMS interface for the database queue, and invoke the Message-driven Beans started by the messages.

When you connect to a database using DB Connector for Cosminexus RM and Cosminexus RM, the following can be realized because the JMS interface and JDBC interface share the physical connection used for access and the processing performance is improved:

The following figure gives an overview of DB Connector for Cosminexus RM and Cosminexus RM processing when the JMS interface and JDBC interface are used to access the database from servlets, JSPs, or Enterprise Beans.

Figure 3-21 Overview of the processing for DB Connector for Cosminexus RM and Cosminexus RM

[Figure]

The database is accessed via Cosminexus RM using the JMS interface, and the database is accessed via DB Connector for Cosminexus RM using the JDBC interface. Note that to set up a queue on the database, the JDBC interface-based database access is used internally with Cosminexus RM. Therefore, the database is accessed via the JDBC driver.

Furthermore, with DB Connector for Cosminexus RM, the database is accessed via Cosminexus RM, by sharing the physical connection with Cosminexus RM. These resource adapters use the connection pool for Cosminexus RM to obtain the connections. As a result, the sharing of the physical connections is realized.

(2) Configuring the database connections using DB Connector for Cosminexus RM and Cosminexus RM

This subsection describes the resource configuration pattern when DB Connector for Cosminexus RM and Cosminexus RM are used for connection. The resource configurations for the following cases will be described here:

Note that the connections can be shared when the same database is accessed with the JMS interface and JDBC interface and when the Message-driven Beans are used. However, to share a connection, the following preconditions must be satisfied:

Preconditions for connection sharing
  • A database queue is accessed using the JMS interface, and a table is accessed using the JDBC interface in the same transaction through the user program.
  • The database on which the queue is set by Cosminexus RM and the database that accesses the table are the same.
  • The same security information (user name and password) and sign-on method are used for accessing the database queue through the JMS interface and for accessing the table on the database through the JDBC interface.
  • The value Shareable is set in the <res-sharing-scope> tag of the DD for the J2EE application that specifies the reference to DB Connector for Cosminexus RM and Cosminexus RM.
    Note
    • When you use only the JDBC interface to access the database, use DB Connector as the resource adapter.
    • If the preconditions for connection sharing are not satisfied, do not access the database using both JMS interface and JDBC interface through DB Connector for Cosminexus RM and Cosminexus RM. In this case, set up the configuration described in (c) When different databases are accessed with the JMS interface and JDBC interface, and use DB Connector to access the tables.
(a) When the JMS interface is used alone

When the database queue alone is accessed with the user program, use the configuration shown in the following figure.

Figure 3-22 Configuration when the JMS interface is used alone

[Figure]

(b) When the same database is accessed with the JMS interface and JDBC interface

When the JMS interface and JDBC interface are used to access the database with the user program, the same database can be accessed by two types of interfaces if the preconditions for connection sharing are satisfied. At this time, use the configuration shown in the following figure.

By using this configuration, you can improve the processing performance of the transactions through connection sharing and utilize the resources effectively.

Figure 3-23 Configuration when the same database is accessed with the JMS interface and JDBC interface

[Figure]

(c) When different databases are accessed with the JMS interface and JDBC interface

When the JMS interface and JDBC interface are used to access the database with the user program, you must use a configuration in which different databases will be accessed for each interface if the preconditions for connection sharing are not satisfied. At this time, use the configuration shown in the following figure.

Figure 3-24 Configuration when different databases are accessed with the JMS interface and JDBC interface

[Figure]

Use DB Connector for Cosminexus RM and Cosminexus RM to access the database queue. Also, to access the database tables, you must prepare and use DB Connector separately.

(d) When the Message-driven Beans are used

When the Message-driven Beans are used, use the configuration show in the following figure. If the connection sharing conditions are satisfied, you can use the JDBC interface of DB Connector for Cosminexus RM and share the connection between the Message-driven Beans and the JDBC interface.

Note that when the Message-driven Beans are used, you can use the global transactions and local transactions when the associated resource adapter is Cosminexus RM 01-01 or later. When you use the Cosminexus RM 01-00 resource adapter, you must use a global transaction. At this time, you cannot use a local transaction, but if the preconditions for connection sharing are satisfied, a global transaction is concluded through a single phase.

Figure 3-25 Configuration when the Message-driven Beans are used

[Figure]