Package org.apache.derby.client.am
Class CachingLogicalConnection
- java.lang.Object
-
- org.apache.derby.client.am.LogicalConnection
-
- org.apache.derby.client.am.CachingLogicalConnection
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper
public class CachingLogicalConnection extends LogicalConnection
A logical connection used in a connection pool with capabilities for caching prepared statements.An instance of this class is what is passed out the the client. It uses a JDBC statement object cache to avoid re-preparing commonly used queries. The cache has scope of a physical connection, and is lost when the pooled connection is closed (which includes closing the physical connection).
- See Also:
StatementCacheInteractor
-
-
Field Summary
Fields Modifier and Type Field Description private StatementCacheInteractorcacheInteractorJDBC statement cache interactor used to prepare statements and calls.-
Fields inherited from class org.apache.derby.client.am.LogicalConnection
physicalConnection_
-
-
Constructor Summary
Constructors Constructor Description CachingLogicalConnection(ClientConnection physicalConnection, ClientPooledConnection pooledConnection, JDBCStatementCache stmtCache)Creates a new logical connection which caches prepared statements.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.sql.CallableStatementprepareCall(java.lang.String sql)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)java.sql.PreparedStatementprepareStatement(java.lang.String sql)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)-
Methods inherited from class org.apache.derby.client.am.LogicalConnection
abort, checkForNullPhysicalConnection, clearWarnings, closeWithoutRecyclingToPool, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, finalize, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getRealMetaDataObject, getSchema, getServerVersion, getTransactionID, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, newLogicalDatabaseMetaData, notifyException, nullPhysicalConnection, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, unwrap
-
-
-
-
Field Detail
-
cacheInteractor
private StatementCacheInteractor cacheInteractor
JDBC statement cache interactor used to prepare statements and calls.
-
-
Constructor Detail
-
CachingLogicalConnection
public CachingLogicalConnection(ClientConnection physicalConnection, ClientPooledConnection pooledConnection, JDBCStatementCache stmtCache) throws SqlException
Creates a new logical connection which caches prepared statements.- Parameters:
physicalConnection- underlying physical database connectionpooledConnection- associated pooled connectionstmtCache- associated statement cache- Throws:
SqlException- if creating the logical connection fails
-
-
Method Detail
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Connection- Overrides:
closein classLogicalConnection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Overrides:
prepareStatementin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Overrides:
prepareStatementin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Overrides:
prepareStatementin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Overrides:
prepareStatementin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Overrides:
prepareStatementin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Overrides:
prepareStatementin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Overrides:
prepareCallin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Overrides:
prepareCallin classLogicalConnection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Overrides:
prepareCallin classLogicalConnection- Throws:
java.sql.SQLException
-
-