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
PreparedStatement s 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
PreparedStatement s 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, unwrap
addTrace, clearTrace, getConfig, getLastUsed, getTrace, printStackTrace, removeTrace, setLastUsed, setLastUsed, setStackTrace
private 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.AutoCloseable
close
in interface java.sql.Connection
close
in class DelegatingConnection
java.sql.SQLException
- The database connection couldn't be closed.public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
PreparedStatement
s 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.Connection
prepareStatement
in class DelegatingConnection
sql
- 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
PreparedStatement
s 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.Connection
prepareStatement
in class DelegatingConnection
java.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.Connection
prepareStatement
in class DelegatingConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class DelegatingConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class DelegatingConnection
java.sql.SQLException
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
prepareStatement
in interface java.sql.Connection
prepareStatement
in class DelegatingConnection
java.sql.SQLException
public boolean isAccessToUnderlyingConnectionAllowed()
ConnectionImpl
public java.sql.Connection getDelegate()
getDelegate
in class DelegatingConnection
isAccessToUnderlyingConnectionAllowed()
public java.sql.Connection getInnermostDelegate()
getInnermostDelegate
in class DelegatingConnection
isAccessToUnderlyingConnectionAllowed()