Package net.sourceforge.jtds.jdbcx.proxy
Class ConnectionProxy
- java.lang.Object
-
- net.sourceforge.jtds.jdbcx.proxy.ConnectionProxy
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper
public class ConnectionProxy extends java.lang.Object implements java.sql.ConnectionThis class would be better implemented as a java.lang.reflect.Proxy. However, this feature was not added until 1.3 and reflection performance was not improved until 1.4. Since the driver still needs to be compatible with 1.2 and 1.3 this class is used to delegate the calls to the connection with minimal overhead.- Version:
- $Id: ConnectionProxy.java,v 1.7.2.3 2009-12-30 08:45:34 ickzon Exp $
-
-
Field Summary
Fields Modifier and Type Field Description private boolean_closedprivate JtdsConnection_connectionprivate PooledConnection_pooledConnection
-
Constructor Summary
Constructors Constructor Description ConnectionProxy(PooledConnection pooledConnection, java.sql.Connection connection)Constructs a new connection proxy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(java.util.concurrent.Executor executor)voidclearWarnings()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidclose()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidcommit()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.ArraycreateArrayOf(java.lang.String typeName, java.lang.Object[] elements)java.sql.BlobcreateBlob()java.sql.ClobcreateClob()java.sql.NClobcreateNClob()java.sql.SQLXMLcreateSQLXML()java.sql.StatementcreateStatement()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.StructcreateStruct(java.lang.String typeName, java.lang.Object[] attributes)protected voidfinalize()Closes the proxy, releasing the connection.booleangetAutoCommit()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.lang.StringgetCatalog()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.util.PropertiesgetClientInfo()java.lang.StringgetClientInfo(java.lang.String name)intgetHoldability()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.DatabaseMetaDatagetMetaData()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.intgetNetworkTimeout()java.lang.StringgetSchema()intgetTransactionIsolation()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.util.MapgetTypeMap()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.SQLWarninggetWarnings()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.booleanisClosed()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.booleanisReadOnly()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.booleanisValid(int timeout)booleanisWrapperFor(java.lang.Class arg0)java.lang.StringnativeSQL(java.lang.String sql)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.CallableStatementprepareCall(java.lang.String sql)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.PreparedStatementprepareStatement(java.lang.String sql)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.(package private) voidprocessSQLException(java.sql.SQLException sqlException)Processes SQLExceptions.voidreleaseSavepoint(java.sql.Savepoint savepoint)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidrollback()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidrollback(java.sql.Savepoint savepoint)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidsetAutoCommit(boolean autoCommit)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidsetCatalog(java.lang.String catalog)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidsetClientInfo(java.lang.String name, java.lang.String value)voidsetClientInfo(java.util.Properties properties)voidsetHoldability(int holdability)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidsetNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds)voidsetReadOnly(boolean readOnly)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.SavepointsetSavepoint()Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.sql.SavepointsetSavepoint(java.lang.String name)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidsetSchema(java.lang.String schema)voidsetTransactionIsolation(int level)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.voidsetTypeMap(java.util.Map map)Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.java.lang.Objectunwrap(java.lang.Class arg0)private voidvalidateConnection()Validates the connection state.
-
-
-
Field Detail
-
_pooledConnection
private PooledConnection _pooledConnection
-
_connection
private JtdsConnection _connection
-
_closed
private boolean _closed
-
-
Constructor Detail
-
ConnectionProxy
public ConnectionProxy(PooledConnection pooledConnection, java.sql.Connection connection)
Constructs a new connection proxy.
-
-
Method Detail
-
clearWarnings
public void clearWarnings() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
clearWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
close
public void close()
Delgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Connection
-
commit
public void commit() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
commitin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getAutoCommit
public boolean getAutoCommit() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getHoldability
public int getHoldability() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getTransactionIsolation
public int getTransactionIsolation() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getTypeMap
public java.util.Map getTypeMap() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
getMetaData
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
getMetaDatain interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
isClosed
public boolean isClosed() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
isClosedin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
isReadOnly
public boolean isReadOnly() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
isReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
nativeSQLin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
releaseSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
rollback
public void rollback() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
rollback
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setHoldability
public void setHoldability(int holdability) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setReadOnly
public void setReadOnly(boolean readOnly) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
setTypeMap
public void setTypeMap(java.util.Map map) throws java.sql.SQLExceptionDelgates calls to the connection; SQLExceptions thrown from the connection will cause an event to be fired on the connection pool listeners.- Specified by:
setTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException- if an error occurs
-
validateConnection
private void validateConnection() throws java.sql.SQLExceptionValidates the connection state.- Throws:
java.sql.SQLException
-
processSQLException
void processSQLException(java.sql.SQLException sqlException) throws java.sql.SQLExceptionProcesses SQLExceptions.- Throws:
java.sql.SQLException
-
finalize
protected void finalize()
Closes the proxy, releasing the connection.- Overrides:
finalizein classjava.lang.Object
-
createArrayOf
public java.sql.Array createArrayOf(java.lang.String typeName, java.lang.Object[] elements) throws java.sql.SQLException- Specified by:
createArrayOfin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createBlob
public java.sql.Blob createBlob() throws java.sql.SQLException- Specified by:
createBlobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createClob
public java.sql.Clob createClob() throws java.sql.SQLException- Specified by:
createClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createNClob
public java.sql.NClob createNClob() throws java.sql.SQLException- Specified by:
createNClobin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createSQLXML
public java.sql.SQLXML createSQLXML() throws java.sql.SQLException- Specified by:
createSQLXMLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStruct
public java.sql.Struct createStruct(java.lang.String typeName, java.lang.Object[] attributes) throws java.sql.SQLException- Specified by:
createStructin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.util.Properties getClientInfo() throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getClientInfo
public java.lang.String getClientInfo(java.lang.String name) throws java.sql.SQLException- Specified by:
getClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isValid
public boolean isValid(int timeout) throws java.sql.SQLException- Specified by:
isValidin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setClientInfo
public void setClientInfo(java.util.Properties properties) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
setClientInfo
public void setClientInfo(java.lang.String name, java.lang.String value) throws java.sql.SQLClientInfoException- Specified by:
setClientInfoin interfacejava.sql.Connection- Throws:
java.sql.SQLClientInfoException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class arg0) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
unwrap
public java.lang.Object unwrap(java.lang.Class arg0) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
setSchema
public void setSchema(java.lang.String schema) throws java.sql.SQLException- Specified by:
setSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getSchema
public java.lang.String getSchema() throws java.sql.SQLException- Specified by:
getSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
abort
public void abort(java.util.concurrent.Executor executor) throws java.sql.SQLException- Specified by:
abortin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setNetworkTimeout
public void setNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds) throws java.sql.SQLException- Specified by:
setNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getNetworkTimeout
public int getNetworkTimeout() throws java.sql.SQLException- Specified by:
getNetworkTimeoutin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
-