JDBC Type 2 Driver Programmer's Reference for SQL/MX Release 3.2.1 (H06.26+, J06.15+)
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” (page 36). In addition to these standard
properties, the ConnectionPoolDataSource includes the JDBC/MX driver-specific properties
as described under “Connecting Using the DataSource Interface” (page 23).
Standard ConnectionPoolDataSource Object Properties
NOTE: The application server defines the meaning of these properties.
Table 7 Standard ConnectionPoolDataSource Object Properties
DescriptionTypeProperty Name
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.
intmaxStatements
The number of physical connections the pool should contain when it is
created.
intinitialPoolSize
The number of physical connections the pool should keep available at
all times. 0 (zero) indicates no maximum size.
intminPoolSize
The maximum number of physical connections that the pool should
contain. 0 (zero) indicates no maximum size.
intmaxPoolSize
The number of seconds a physical connection should remain unused in
the pool before the connection is closed. 0 (zero) indicates no limit.
intmaxIdleTime
The interval, in seconds, that the pool should wait before enforcing the
current policy defined by the values of the above connection pool
properties.
intpropertyCycle
Connection Pooling Using the Basic DataSource API
For your JDBC application to enable connection pooling, use the basic DataSource interface,
which includes the following properties that control connection pooling:
• maxPoolSize
• minPoolSize
• maxStatements
Your application can enable connection pooling in the following two ways:
• By setting the dataSourceName property in the basic DataSource object to the previously
registered ConnectionPoolDataSource object. When the connection pooling is enabled,
the JDBC/MX driver-specific properties in the ConnectionPoolDataSource object are
effective, and the JDBC/MX driver-specific properties in the DataSource object are ignored.
36 Accessing SQL Databases with SQL/MX










