class ConnectionImpl extends DelegatingConnection
Connection that will be returned
from PooledConnectionImpl.getConnection().
Most methods are wrappers around the jdbc 1.x Connection.
A few exceptions include preparedStatement and close.
In accordance with the jdbc specification this Connection cannot
be used after closed() is called. Any further usage will result in an
SQLException.
ConnectionImpl extends DelegatingConnection to enable access to the
underlying connection.| Modifier and Type | Field and Description |
|---|---|
private boolean |
accessToUnderlyingConnectionAllowed |
private PooledConnectionImpl |
pooledConnection
The object that instantiated this object
|
_closed, _conn| Constructor and Description |
|---|
ConnectionImpl(PooledConnectionImpl pooledConnection,
java.sql.Connection connection,
boolean accessToUnderlyingConnectionAllowed)
Creates a
ConnectionImpl. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Marks the Connection as closed, and notifies the pool that the
pooled connection is available.
|
java.sql.Connection |
getDelegate()
Get the delegated connection, if allowed.
|
java.sql.Connection |
getInnermostDelegate()
Get the innermost connection, if allowed.
|
boolean |
isAccessToUnderlyingConnectionAllowed()
If false, getDelegate() and getInnermostDelegate() will return null.
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
If pooling of
PreparedStatements is turned on in the
DriverAdapterCPDS, a pooled object may be returned, otherwise
delegate to the wrapped jdbc 1.x Connection. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
If pooling of
PreparedStatements is turned on in the
DriverAdapterCPDS, a pooled object may be returned, otherwise
delegate to the wrapped jdbc 1.x Connection. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames) |
abort, activate, checkOpen, clearWarnings, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, equals, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getDelegateInternal, getHoldability, getInnermostDelegateInternal, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, handleException, hashCode, innermostDelegateEquals, isClosed, isReadOnly, isValid, isWrapperFor, nativeSQL, passivate, prepareCall, prepareCall, prepareCall, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setDelegate, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setTransactionIsolation, setTypeMap, toString, unwrapaddTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTraceprivate final boolean accessToUnderlyingConnectionAllowed
private final PooledConnectionImpl pooledConnection
ConnectionImpl(PooledConnectionImpl pooledConnection, java.sql.Connection connection, boolean accessToUnderlyingConnectionAllowed)
ConnectionImpl.pooledConnection - The PooledConnection that is calling the ctor.connection - The JDBC 1.x Connection to wrap.accessToUnderlyingConnectionAllowed - if true, then access is allowed to the underlying connectiionpublic void close()
throws java.sql.SQLException
close in interface java.lang.AutoCloseableclose in interface java.sql.Connectionclose in class DelegatingConnectionjava.sql.SQLException - The database connection couldn't be closed.public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
PreparedStatements is turned on in the
DriverAdapterCPDS, a pooled object may be returned, otherwise
delegate to the wrapped jdbc 1.x Connection.prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionsql - SQL statement to be preparedjava.sql.SQLException - if this connection is closed or an error occurs
in the wrapped connection.public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
PreparedStatements is turned on in the
DriverAdapterCPDS, a pooled object may be returned, otherwise
delegate to the wrapped jdbc 1.x Connection.prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionjava.sql.SQLException - if this connection is closed or an error occurs
in the wrapped connection.public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionjava.sql.SQLExceptionpublic java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
prepareStatement in interface java.sql.ConnectionprepareStatement in class DelegatingConnectionjava.sql.SQLExceptionpublic boolean isAccessToUnderlyingConnectionAllowed()
ConnectionImplpublic java.sql.Connection getDelegate()
getDelegate in class DelegatingConnectionisAccessToUnderlyingConnectionAllowed()public java.sql.Connection getInnermostDelegate()
getInnermostDelegate in class DelegatingConnectionisAccessToUnderlyingConnectionAllowed()