JDBC Driver for SQL/MX Programmer's Reference
Connection Pooling by an Application Server
Usually, in a three-tier environment, the application server implements the connection pooling
component. How to implement this component is described in these topics:
Guidelines for Implementing an Application Server to Use Connection Pooling●
Standard ConnectionPoolDataSource Object Properties●
Guidelines for Implementing an Application Server to Use
Connection Pooling
The application server maintains a cache of the PooledConnection objects created by
using ConnectionPoolDataSource interface. When the client requests a connection
object, the application looks for the suitable PooledConnection object. The lookup
criteria and other methods are specific to the application server.
●
The application server implements the ConnectionEventListener interface and
registers the listener object with the PooledConnection object. The JDBC/MX driver
notifies the listener object with a connectionClosed event when the application is
finished using the Connection object. Then, the connection pooling component can reuse this
PooledConnection object for future requests. The JDBC/MX driver also notifies the
listener object with connectionErrorOccurred event when the PooledConnection
object fails to initialize the connection. The application server's connection pooling
component should discard the PooledConnection when such a connection error event
occurs.
●
The application server manages the connection pool by using the
SQLMXConnectionPoolDataSource, which implements the
ConnectionPoolDataSource interface. Use the getter and setter methods, provided by
JDBC/MX, to set the connection pool configuration properties listed in the table of Standard
ConnectionPoolDataSource Object Properties. In addition to these standard properties, the
ConnectionPoolDataSource includes the JDBC/MX driver-specific properties as
described under Connection Using the DataSource Interface.
●
Standard ConnectionPoolDataSource Object Properties
Note: The application server defines the meaning of these properties.
Property Name Type Description
maxStatements int
The total number of PreparedStatement
objects that the pool should cache. This total
includes both free objects and objects in use.
0 (zero) disables statement pooling.