|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.apache.commons.dbcp.AbandonedTrace
org.apache.commons.dbcp.DelegatingConnection
org.apache.commons.dbcp.PoolingConnection
public class PoolingConnection
A DelegatingConnection that pools PreparedStatements.
The prepareStatement(java.lang.String) and prepareCall(java.lang.String) 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.)
PoolablePreparedStatement| Field Summary |
|---|
| Fields inherited from interface java.sql.Connection |
|---|
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE |
| Constructor Summary | |
|---|---|
PoolingConnection(java.sql.Connection c)
Constructor. |
|
PoolingConnection(java.sql.Connection c,
org.apache.commons.pool.KeyedObjectPool pool)
Constructor. |
|
| Method Summary | |
|---|---|
void |
activateObject(java.lang.Object key,
java.lang.Object obj)
KeyedPoolableObjectFactory method for activating
pooled statements. |
void |
close()
Close and free all PreparedStatements or CallableStatement from the pool, and
close the underlying connection. |
void |
destroyObject(java.lang.Object key,
java.lang.Object obj)
KeyedPoolableObjectFactory method for destroying
PoolablePreparedStatements and PoolableCallableStatements. |
java.lang.Object |
makeObject(java.lang.Object obj)
KeyedPoolableObjectFactory method for creating
PoolablePreparedStatements or PoolableCallableStatements. |
void |
passivateObject(java.lang.Object key,
java.lang.Object obj)
KeyedPoolableObjectFactory method for passivating
PreparedStatements or CallableStatements. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Create or obtain a CallableStatement from the pool. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Create or obtain a CallableStatement from the pool. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Create or obtain a PreparedStatement from the pool. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Create or obtain a PreparedStatement from the pool. |
java.lang.String |
toString()
Returns a string representation of the metadata associated with the innnermost delegate connection. |
boolean |
validateObject(java.lang.Object key,
java.lang.Object obj)
KeyedPoolableObjectFactory method for validating
pooled statements. |
| Methods inherited from class org.apache.commons.dbcp.AbandonedTrace |
|---|
printStackTrace |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.sql.Connection |
|---|
clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap |
| Methods inherited from interface java.sql.Wrapper |
|---|
isWrapperFor, unwrap |
| Constructor Detail |
|---|
public PoolingConnection(java.sql.Connection c)
c - the underlying Connection.
public PoolingConnection(java.sql.Connection c,
org.apache.commons.pool.KeyedObjectPool pool)
c - the underlying Connection.pool - KeyedObjectPool of PreparedStatements and CallableStatements.| Method Detail |
|---|
public void activateObject(java.lang.Object key,
java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for activating
pooled statements.
activateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - pooled statement to be activated
java.lang.Exception
public void close()
throws java.sql.SQLException
PreparedStatements or CallableStatement from the pool, and
close the underlying connection.
close in interface java.sql.Connectionclose in class DelegatingConnectionjava.sql.SQLException
public void destroyObject(java.lang.Object key,
java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for destroying
PoolablePreparedStatements and PoolableCallableStatements.
Closes the underlying statement.
destroyObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - the pooled statement to be destroyed.
java.lang.Exception
public java.lang.Object makeObject(java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for creating
PoolablePreparedStatements or PoolableCallableStatements.
The stmtType field in the key determines whether
a PoolablePreparedStatement or PoolableCallableStatement is created.
makeObject in interface org.apache.commons.pool.KeyedPoolableObjectFactoryobj - the key for the PreparedStatement to be created
java.lang.ExceptioncreateKey(String, int, int, byte)
public void passivateObject(java.lang.Object key,
java.lang.Object obj)
throws java.lang.Exception
KeyedPoolableObjectFactory method for passivating
PreparedStatements or CallableStatements.
Invokes PreparedStatement.clearParameters().
passivateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - a PreparedStatement
java.lang.Exception
public java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
CallableStatement from the pool.
prepareCall in interface java.sql.ConnectionprepareCall in class DelegatingConnectionsql - the sql string used to define the CallableStatement
PoolableCallableStatement
java.sql.SQLException
public java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
CallableStatement from the pool.
prepareCall in interface java.sql.ConnectionprepareCall in class DelegatingConnectionsql - the sql string used to define the CallableStatementresultSetType - result set typeresultSetConcurrency - result set concurrency
PoolableCallableStatement
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
PreparedStatement from the pool.
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionsql - the sql string used to define the PreparedStatement
PoolablePreparedStatement
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
PreparedStatement from the pool.
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionsql - the sql string used to define the PreparedStatementresultSetType - result set typeresultSetConcurrency - result set concurrency
PoolablePreparedStatement
java.sql.SQLExceptionpublic java.lang.String toString()
DelegatingConnection
toString in class DelegatingConnection
public boolean validateObject(java.lang.Object key,
java.lang.Object obj)
KeyedPoolableObjectFactory method for validating
pooled statements. Currently always returns true.
validateObject in interface org.apache.commons.pool.KeyedPoolableObjectFactorykey - ignoredobj - ignored
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||