Connection caching

How it works

A connection cache contains a pool of preallocated connections that components can use repeatedly as needed to communicate with a database server using a common user name and password. Connection caching provides:

To realize these benefits, a component must be coded to use a cached connection only when necessary and to release the connection back to the cache at other times. A component should not hold connections while waiting for more input from the client application. As a general rule, each method call that requires a third-tier connection should take a connection handle when invoked and release it before returning.

JDBC 2.0 drivers provide implicit support for connection pooling. When using JDBC drivers that do not conform to the JDBC 2. 0 specification, you can define a connection cache in the Adaptive Server plug-in or PowerJ for your components’ use.

NoteTransaction support requires cached connections If your component participates in EJB Server transactions, you must use an JDBC 2.0 driver or define an EJB Server connection cache and obtain connections using the EJB Server connection manager classes.

Java Connection Manager classes

Java components can use the Java Connection Manager (JCM) classes for connection caching. The JCM classes manage JDBC connections.

The JCM classes are:

To access a connection cache, configure a PowerJ transaction object to connect to the cache, and use the transaction object. Typically, you will also use a query or DataStore object.