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 StatementCacheInteractorJDBC statement cache interactor used to prepare statements and calls.Fields inherited from class LogicalConnection
physicalConnection_Fields inherited from interface 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 TypeMethodDescriptionvoidclose()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 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, unwrapMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Overrides:
closein classLogicalConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classLogicalConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classLogicalConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classLogicalConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classLogicalConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classLogicalConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classLogicalConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classLogicalConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classLogicalConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classLogicalConnection- Throws:
SQLException
-