Class PoolingConnection

All Implemented Interfaces:
AutoCloseable, Connection, Wrapper, org.apache.commons.pool2.KeyedPooledObjectFactory<PStmtKey,DelegatingPreparedStatement>, org.apache.commons.pool2.TrackedUse

public class PoolingConnection extends DelegatingConnection<Connection> implements org.apache.commons.pool2.KeyedPooledObjectFactory<PStmtKey,DelegatingPreparedStatement>
A DelegatingConnection that pools PreparedStatements.

The prepareStatement(org.apache.commons.dbcp2.PStmtKey) and prepareCall(org.apache.commons.dbcp2.PStmtKey) methods, rather than creating a new PreparedStatement each time, may actually pull the statement from a pool of unused statements. The Statement.close() method of the returned statement doesn't actually close the statement, but rather returns it to the pool. (See PoolablePreparedStatement, PoolableCallableStatement.)

Since:
2.0
See Also: