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:
AutoCloseable
,Connection
,Wrapper
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StatementCacheInteractor
JDBC statement cache interactor used to prepare statements and calls.Fields inherited from class org.apache.derby.client.am.LogicalConnection
physicalConnection_
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorsConstructorDescriptionCachingLogicalConnection
(ClientConnection physicalConnection, ClientPooledConnection pooledConnection, JDBCStatementCache stmtCache) Creates a new logical connection which caches prepared statements. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
prepareCall
(String sql) prepareCall
(String sql, int resultSetType, int resultSetConcurrency) prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql) prepareStatement
(String sql, int autoGeneratedKeys) prepareStatement
(String sql, int[] columnIndexes) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql, 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
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
cacheInteractor
JDBC statement cache interactor used to prepare statements and calls.
-
-
Constructor Details
-
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 Details
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classLogicalConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classLogicalConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classLogicalConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classLogicalConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classLogicalConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classLogicalConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Overrides:
prepareStatement
in classLogicalConnection
- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in classLogicalConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in classLogicalConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Overrides:
prepareCall
in classLogicalConnection
- Throws:
SQLException
-