JDBC Driver for SQL/MP 3.0
sds.setPoolLogging(true);
//In application code
DataSource ds;
//After obtaining the data source
PrintWriter writer = new PrintWriter(System.out,true);
ds.setLogWriter(writer);
ds.setPoolLogging(true);
When poolLogging is set to true, the pool writes information about the number of connections or statements currently
in the pool. The pool also writes a message whenever the statement pool is full and a PreparedStatement is requested
that is not in the free pool. In this case, the pool removes the least recently used statement from the free pool and
creates the requested PreparedStatement. If these messages occur frequently, consider increasing the size of the
statement pool.
Note: Because the pool can write a large amount of data to the output writer when setPoolLogging is
true, do not turn on poolLogging in a production environment unless you need to debug issues that involve
the pool size.
Using an SQLMPDataSource with an SQLMPConnectionPoolDataSource
An SQLMPDataSource object can be deployed that refers to an already deployed SQLMPConnectionPoolDataSource
object. To do this deployment, set the dataSourceName property in the SQLMPDataSource object to the previously
registered SQLMPConnectionPoolDataSource object.
Note: When an SQLMPDataSource object refers to an SQLMPConnectionPoolDataSource object, the
properties in the SQLMPConnectionPoolDataSource object are used as default values for the
SQLMPDataSource. This means that any values that were not set in the SQLMPDataSource when it was
deployed use the values set in the SQLMPConnectionPoolDataSource.
Statement Pooling
Statement pooling allows applications to reuse PreparedStatement objects in much the same way connection objects
can be reused in a connection-pooling environment.
To enable statement pooling set the maxStatements property of either the DriverManger class or basic DataSource
implementation to a value greater than zero (0).
Note these JDBC/MP driver-implementation details when using and troubleshooting statement pooling:
The properties passed through the Properties parameter have precedence over the command-line properties.
Statement pooling is completely transparent to the application. Pooled statements are not associated with a
specific connection but are pooled across the application.
When using statement pooling, the application should explicitly close the prepared statement using the
PreparedStatement.close method. PreparedStatement objects that are not in scope are not reused unless the
application explicitly closes them.
When an application requests a PreparedStatement object, the pool tries to find a proper object in the free
pool. For JDBC/MP, some of the factors that determine whether an object is proper are the SQL string, catalog,
resultSet
type, and
resultSet
concurrency. If a suitable proper exists, the pool returns the object to the