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:
Improved performance through reuse of connections The EJB Server connection manager allows client sessions to share previously opened connections so that server CPU time and memory are not consumed by opening more connections than necessary.
Improved scalability Since connection caching allows the same number of clients to be serviced using fewer connections, less memory and other resources are required.
Support for transaction semantics EJB Server’s declarative transaction model requires that you call the connection caching APIs to obtain and release all database connections
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.
Transaction 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 components can use the Java Connection Manager (JCM) classes for connection caching. The JCM classes manage JDBC connections.
The JCM classes are:
com.sybase.jaguar.jcm.JCMCache Represents a configured connection cache and provides methods to manage connections in the cache.
com.sybase.jaguar.jcm.JCM Provides access to JDBC connection caches defined in the Adaptive Server plug-in. JCM methods return JCMCache instances.
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.