Package org.apache.commons.dbcp2
Class PoolablePreparedStatement<K>
- java.lang.Object
-
- org.apache.commons.dbcp2.AbandonedTrace
-
- org.apache.commons.dbcp2.DelegatingStatement
-
- org.apache.commons.dbcp2.DelegatingPreparedStatement
-
- org.apache.commons.dbcp2.PoolablePreparedStatement<K>
-
- Type Parameters:
K- the key type
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.PreparedStatement,java.sql.Statement,java.sql.Wrapper,org.apache.commons.pool2.TrackedUse
public class PoolablePreparedStatement<K> extends DelegatingPreparedStatement
ADelegatingPreparedStatementthat cooperates withPoolingConnectionto implement a pool ofPreparedStatements.My
close()method returns me to my containing pool. (SeePoolingConnection.)- Since:
- 2.0
- Version:
- $Id: PoolablePreparedStatement.java 1649430 2015-01-04 21:29:32Z tn $
- Author:
- Rodney Waldhoff, Glenn L. Nielsen, James House, Dirk Verbeeck
- See Also:
PoolingConnection
-
-
Constructor Summary
Constructors Constructor Description PoolablePreparedStatement(java.sql.PreparedStatement stmt, K key, org.apache.commons.pool2.KeyedObjectPool<K,PoolablePreparedStatement<K>> pool, DelegatingConnection<?> conn)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()voidaddBatch()Add batch.voidclearBatch()Clear Batch.voidclose()Return me to my pool.voidpassivate()-
Methods inherited from class org.apache.commons.dbcp2.DelegatingPreparedStatement
clearParameters, execute, executeQuery, executeUpdate, getMetaData, getParameterMetaData, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBoolean, setByte, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setDate, setDate, setDouble, setFloat, setInt, setLong, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setNull, setNull, setObject, setObject, setObject, setRef, setRowId, setShort, setSQLXML, setString, setTime, setTime, setTimestamp, setTimestamp, setURL, toString
-
Methods inherited from class org.apache.commons.dbcp2.DelegatingStatement
addBatch, cancel, clearWarnings, closeOnCompletion, execute, execute, execute, execute, executeBatch, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getDelegate, getFetchDirection, getFetchSize, getGeneratedKeys, getInnermostDelegate, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isWrapperFor, setCursorName, setDelegate, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout, unwrap
-
Methods inherited from class org.apache.commons.dbcp2.AbandonedTrace
getLastUsed
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.sql.PreparedStatement
executeLargeUpdate, setObject, setObject
-
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearWarnings, closeOnCompletion, enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, execute, execute, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, isSimpleIdentifier, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
-
-
-
Constructor Detail
-
PoolablePreparedStatement
public PoolablePreparedStatement(java.sql.PreparedStatement stmt, K key, org.apache.commons.pool2.KeyedObjectPool<K,PoolablePreparedStatement<K>> pool, DelegatingConnection<?> conn)Constructor- Parameters:
stmt- my underlyingPreparedStatementkey- my key" as used byKeyedObjectPoolpool- theKeyedObjectPoolfrom which I was obtained.conn- theConnectionfrom which I was created
-
-
Method Detail
-
addBatch
public void addBatch() throws java.sql.SQLExceptionAdd batch.- Specified by:
addBatchin interfacejava.sql.PreparedStatement- Overrides:
addBatchin classDelegatingPreparedStatement- Throws:
java.sql.SQLException
-
clearBatch
public void clearBatch() throws java.sql.SQLExceptionClear Batch.- Specified by:
clearBatchin interfacejava.sql.Statement- Overrides:
clearBatchin classDelegatingStatement- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLExceptionReturn me to my pool.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Statement- Overrides:
closein classDelegatingStatement- Throws:
java.sql.SQLException
-
activate
public void activate() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
passivate
public void passivate() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
-