Package com.sun.gjc.spi.jdbc40
Class ProfiledConnectionWrapper40
- java.lang.Object
-
- com.sun.gjc.spi.base.ConnectionHolder
-
- com.sun.gjc.spi.jdbc40.ConnectionHolder40
-
- com.sun.gjc.spi.jdbc40.ProfiledConnectionWrapper40
-
- All Implemented Interfaces:
ConnectionWrapper,AutoCloseable,Connection,Wrapper
public class ProfiledConnectionWrapper40 extends ConnectionHolder40 implements ConnectionWrapper
Wrapper class that aids to provide wrapper for Statement, PreparedStatement, CallableStatement, DatabaseMetaData. Along with providing a wrapper, this aids in logging the SQL statements executed by the various applications.- Author:
- Shalini M
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.gjc.spi.base.ConnectionHolder
ConnectionHolder.ConnectionType
-
-
Field Summary
-
Fields inherited from class com.sun.gjc.spi.jdbc40.ConnectionHolder40
defaultClientInfo, localStrings
-
Fields inherited from class com.sun.gjc.spi.base.ConnectionHolder
active, con, isClosed, mc, sm, statementTimeout, statementTimeoutEnabled, valid, wrappedAlready
-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Constructor Summary
Constructors Constructor Description ProfiledConnectionWrapper40(Connection con, ManagedConnectionImpl mc, jakarta.resource.spi.ConnectionRequestInfo cxRequestInfo, SQLTraceDelegator delegator)Instantiates connection wrapper to wrap JDBC objects.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CallableStatementWrapper40callableCachedStatement(String sql, int resultSetType, int resultSetConcurrency, boolean enableCaching)CallableStatementWrapper40callableCachedStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean enableCaching)StatementcreateStatement()Creates a statement from the underlying ConnectionStatementcreateStatement(int resultSetType, int resultSetConcurrency)Creates a statement from the underlying Connection.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)Creates a statement from the underlying Connection.DatabaseMetaDatagetMetaData()Retrieves theDatabaseMetaDataobject from the underlyingConnectionobject.PreparedStatementWrapper40prepareCachedStatement(String sql, int[] columnIndexes, boolean enableCaching)PreparedStatementWrapper40prepareCachedStatement(String sql, int autoGeneratedKeys, boolean enableCaching)PreparedStatementWrapper40prepareCachedStatement(String sql, int resultSetType, int resultSetConcurrency, boolean enableCaching)PreparedStatementWrapper40prepareCachedStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean enableCaching)PreparedStatementWrapper40prepareCachedStatement(String sql, String[] columnNames, boolean enableCaching)CallableStatementprepareCall(String sql)Creates aCallableStatementobject for calling database stored procedures.CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)Creates aCallableStatementobject for calling database stored procedures.CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Creates aCallableStatementobject for calling database stored procedures.PreparedStatementprepareStatement(String sql)Creates aPreparedStatementobject for sending parameterized SQL statements to databasePreparedStatementprepareStatement(String sql, int autoGeneratedKeys)Creates aPreparedStatementobject for sending parameterized SQL statements to databasePreparedStatementprepareStatement(String sql, int[] columnIndexes)Creates aPreparedStatementobject for sending parameterized SQL statements to databasePreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)Creates aPreparedStatementobject for sending parameterized SQL statements to databasePreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)Creates aPreparedStatementobject for sending parameterized SQL statements to databasePreparedStatementprepareStatement(String sql, String[] columnNames)Creates aPreparedStatementobject for sending parameterized SQL statements to database-
Methods inherited from class com.sun.gjc.spi.jdbc40.ConnectionHolder40
abort, close, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStruct, getClientInfo, getClientInfo, getNetworkTimeout, getSchema, init, isValid, isWrapperFor, setClientInfo, setClientInfo, setNetworkTimeout, setSchema, unwrap
-
Methods inherited from class com.sun.gjc.spi.base.ConnectionHolder
associateConnection, checkValidity, clearWarnings, commit, dissociateConnection, getAutoCommit, getCatalog, getConnection, getConnectionType, getHoldability, getManagedConnection, getMethodExecutor, getTransactionIsolation, getTypeMap, getWarnings, invalidate, isClosed, isReadOnly, isWrapped, jdbcPreInvoke, nativeSQL, performLazyAssociation, performLazyEnlistment, releaseSavepoint, rollback, rollback, setActive, setAutoCommit, setCatalog, setClosed, setConnectionType, setHoldability, setLazyAssociatableConnectionManager, setLazyEnlistableConnectionManager, setReadOnly, setSavepoint, setSavepoint, setTransactionIsolation, setTypeMap, wrapped
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
-
-
-
Constructor Detail
-
ProfiledConnectionWrapper40
public ProfiledConnectionWrapper40(Connection con, ManagedConnectionImpl mc, jakarta.resource.spi.ConnectionRequestInfo cxRequestInfo, SQLTraceDelegator delegator)
Instantiates connection wrapper to wrap JDBC objects.- Parameters:
con- Connection that is wrappedmc- Managed ConnectioncxRequestInfo- Connection Request Infodelegator-
-
-
Method Detail
-
createStatement
public Statement createStatement() throws SQLException
Creates a statement from the underlying Connection- Specified by:
createStatementin interfaceConnection- Overrides:
createStatementin classConnectionHolder- Returns:
Statementobject.- Throws:
SQLException- In case of a database error.
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
Creates a statement from the underlying Connection.- Specified by:
createStatementin interfaceConnection- Overrides:
createStatementin classConnectionHolder- Parameters:
resultSetType- Type of the ResultSetresultSetConcurrency- ResultSet Concurrency.- Returns:
Statementobject.- Throws:
SQLException- In case of a database error.
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
Creates a statement from the underlying Connection.- Specified by:
createStatementin interfaceConnection- Overrides:
createStatementin classConnectionHolder- Parameters:
resultSetType- Type of the ResultSetresultSetConcurrency- ResultSet Concurrency.resultSetHoldability- ResultSet Holdability.- Returns:
Statementobject.- Throws:
SQLException- In case of a database error.
-
getMetaData
public DatabaseMetaData getMetaData() throws SQLException
Retrieves theDatabaseMetaDataobject from the underlyingConnectionobject.- Specified by:
getMetaDatain interfaceConnection- Overrides:
getMetaDatain classConnectionHolder- Returns:
DatabaseMetaDataobject.- Throws:
SQLException- In case of a database error.
-
prepareCall
public CallableStatement prepareCall(String sql) throws SQLException
Creates aCallableStatementobject for calling database stored procedures.- Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classConnectionHolder- Parameters:
sql- SQL Statement- Returns:
CallableStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
Creates aCallableStatementobject for calling database stored procedures.- Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classConnectionHolder- Parameters:
sql- SQL StatementresultSetType- Type of the ResultSetresultSetConcurrency- ResultSet Concurrency.- Returns:
CallableStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
Creates aCallableStatementobject for calling database stored procedures.- Specified by:
prepareCallin interfaceConnection- Overrides:
prepareCallin classConnectionHolder- Parameters:
sql- SQL StatementresultSetType- Type of the ResultSetresultSetConcurrency- ResultSet Concurrency.resultSetHoldability- ResultSet Holdability.- Returns:
CallableStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareStatement
public PreparedStatement prepareStatement(String sql) throws SQLException
Creates aPreparedStatementobject for sending parameterized SQL statements to database- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classConnectionHolder- Parameters:
sql- SQL Statement- Returns:
PreparedStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
Creates aPreparedStatementobject for sending parameterized SQL statements to database- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classConnectionHolder- Parameters:
sql- SQL StatementautoGeneratedKeys- a flag indicating AutoGeneratedKeys need to be returned.- Returns:
PreparedStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
Creates aPreparedStatementobject for sending parameterized SQL statements to database- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classConnectionHolder- Parameters:
sql- SQL StatementcolumnIndexes- an array of column indexes indicating the columns that should be returned from the inserted row or rows.- Returns:
PreparedStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
Creates aPreparedStatementobject for sending parameterized SQL statements to database- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classConnectionHolder- Parameters:
sql- SQL StatementresultSetType- Type of the ResultSetresultSetConcurrency- ResultSet Concurrency.- Returns:
PreparedStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
Creates aPreparedStatementobject for sending parameterized SQL statements to database- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classConnectionHolder- Parameters:
sql- SQL StatementresultSetType- Type of the ResultSetresultSetConcurrency- ResultSet Concurrency.resultSetHoldability- ResultSet Holdability.- Returns:
PreparedStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
Creates aPreparedStatementobject for sending parameterized SQL statements to database- Specified by:
prepareStatementin interfaceConnection- Overrides:
prepareStatementin classConnectionHolder- Parameters:
sql- SQL StatementcolumnNames- Name of bound columns.- Returns:
PreparedStatementobject.- Throws:
SQLException- In case of a database error.
-
prepareCachedStatement
public PreparedStatementWrapper40 prepareCachedStatement(String sql, int resultSetType, int resultSetConcurrency, boolean enableCaching) throws SQLException
- Specified by:
prepareCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
prepareCachedStatement
public PreparedStatementWrapper40 prepareCachedStatement(String sql, String[] columnNames, boolean enableCaching) throws SQLException
- Specified by:
prepareCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
prepareCachedStatement
public PreparedStatementWrapper40 prepareCachedStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean enableCaching) throws SQLException
- Specified by:
prepareCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
prepareCachedStatement
public PreparedStatementWrapper40 prepareCachedStatement(String sql, int[] columnIndexes, boolean enableCaching) throws SQLException
- Specified by:
prepareCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
prepareCachedStatement
public PreparedStatementWrapper40 prepareCachedStatement(String sql, int autoGeneratedKeys, boolean enableCaching) throws SQLException
- Specified by:
prepareCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
callableCachedStatement
public CallableStatementWrapper40 callableCachedStatement(String sql, int resultSetType, int resultSetConcurrency, boolean enableCaching) throws SQLException
- Specified by:
callableCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
callableCachedStatement
public CallableStatementWrapper40 callableCachedStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, boolean enableCaching) throws SQLException
- Specified by:
callableCachedStatementin interfaceConnectionWrapper- Throws:
SQLException
-
-