org.apache.derby.client.am
Class ClientConnection
- java.lang.Object
-
- org.apache.derby.client.am.ClientConnection
-
- All Implemented Interfaces:
- java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper, ConnectionCallbackInterface
- Direct Known Subclasses:
- NetConnection
public abstract class ClientConnection extends java.lang.Object implements java.sql.Connection, ConnectionCallbackInterface
-
-
Field Summary
Fields Modifier and Type Field and Description Agentagent_booleanautoCommit_intcommBufferSize_ClientDatabaseMetaDatadatabaseMetaData_java.lang.StringdatabaseName_BasicClientDataSource40dataSource_intportNumber_java.lang.StringproductID_booleanresetConnectionAtFirstSql_java.lang.StringserverNameIP_static intXA_T0_NOT_ASSOCIATEDXA_T0_NOT_ASSOCIATEDThis connection is not currently associated with an XA transaction In this state commits will flow in autocommit mode.static intXA_T1_ASSOCIATEDXA_T1_ASSOCIATEDIn this state commits will not flow in autocommit mode.intxaHostVersion_
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description voidabort(java.util.concurrent.Executor executor)voidclearWarnings()voidclose()voidcloseResources()voidcommit()voidcompleteAbnormalUnitOfWork()voidcompleteAbnormalUnitOfWork(UnitOfWorkListener uwl)Rollback the UnitOfWorkListener specifically.voidcompleteChainBreakingDisconnect()voidcompleteConnect()voidcompleteInitialPiggyBackIsolation(int pbIsolation)Sets the default isolation level of the connection upon connection initialization.voidcompleteInitialPiggyBackSchema(java.lang.String pbSchema)Sets the current schema upon connection initialization.voidcompleteLocalCommit()voidcompleteLocalRollback()voidcompletePiggyBackIsolation(int pbIsolation)Completes piggy-backing of the new current isolation level by updating the cached copy in am.Connection.voidcompletePiggyBackSchema(java.lang.String pbSchema)Completes piggy-backing of the new current schema by updating the cached copy in am.Connection.voidcompleteSqlca(Sqlca sqlca)java.sql.BlobcreateBlob()Constructs an object that implements theBlobinterface.java.sql.ClobcreateClob()Constructs an object that implements theClobinterface.java.sql.StatementcreateStatement()java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency)java.sql.StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)booleanflowAutoCommit()booleangetAutoCommit()java.lang.StringgetCatalog()java.lang.StringgetCurrentSchemaName()Returns the current schema (the schema that would be used for compilation.intgetHoldability()java.sql.DatabaseMetaDatagetMetaData()intgetNetworkTimeout()java.lang.StringgetSchema()Get the name of the current schema.intgetServerVersion()intgetTransactionID()Returns the ID of the active transaction for this connection.intgetTransactionIsolation()intgetTransactionIsolationX()java.util.Map<java.lang.String,java.lang.Class<?>>getTypeMap()java.sql.SQLWarninggetWarnings()intgetXAState()booleanisAborting()Return true if the connection is abortingbooleanisClosed()booleanisClosedX()booleanisPhysicalConnClosed()Return true if the physical connection is still open.booleanisReadOnly()booleanisXAConnection()voidlightReset()java.lang.StringnativeSQL(java.lang.String sql)abstract SectionManagernewSectionManager(Agent agent)java.sql.CallableStatementprepareCall(java.lang.String sql)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.CallableStatementprepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)java.sql.PreparedStatementprepareStatement(java.lang.String sql)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int autoGeneratedKeys)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int[] columnIndexes)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)java.sql.PreparedStatementprepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)java.sql.PreparedStatementprepareStatement(java.lang.String sql, java.lang.String[] columnNames)abstract voidreadCommitSubstitute_()abstract voidreadLocalCommit_()abstract voidreadLocalRollback_()abstract voidreadLocalXACommit_()abstract voidreadLocalXARollback_()abstract voidreadLocalXAStart_()voidreadTransactionStart()voidreleaseSavepoint(java.sql.Savepoint savepoint)voidreset(LogWriter logWriter)voidrollback()voidrollback(java.sql.Savepoint savepoint)voidsetAutoCommit(boolean autoCommit)voidsetCatalog(java.lang.String catalog)voidsetHoldability(int holdability)voidsetNetworkTimeout(java.util.concurrent.Executor executor, int milliseconds)voidsetReadOnly(boolean readOnly)java.sql.SavepointsetSavepoint()java.sql.SavepointsetSavepoint(java.lang.String name)voidsetSchema(java.lang.String schemaName)Set the default schema for the Connection.voidsetTransactionIsolation(int level)voidsetTypeMap(java.util.Map map)voidsetXAState(int state)booleantransactionInProgress()Check if there are uncommitted operations in the current transaction that prevent us from closing the connection.booleanwillAutoCommitGenerateFlow()abstract voidwriteCommitSubstitute_()abstract voidwriteLocalCommit_()abstract voidwriteLocalRollback_()abstract voidwriteLocalXACommit_()abstract voidwriteLocalXARollback_()abstract voidwriteLocalXAStart_()voidwriteTransactionStart(ClientStatement statement)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
agent_
public Agent agent_
-
databaseMetaData_
public ClientDatabaseMetaData databaseMetaData_
-
databaseName_
public java.lang.String databaseName_
-
productID_
public java.lang.String productID_
-
autoCommit_
public boolean autoCommit_
-
XA_T0_NOT_ASSOCIATED
public static final int XA_T0_NOT_ASSOCIATED
XA_T0_NOT_ASSOCIATEDThis connection is not currently associated with an XA transaction In this state commits will flow in autocommit mode.- See Also:
- Constant Field Values
-
XA_T1_ASSOCIATED
public static final int XA_T1_ASSOCIATED
XA_T1_ASSOCIATEDIn this state commits will not flow in autocommit mode.- See Also:
- Constant Field Values
-
xaHostVersion_
public int xaHostVersion_
-
dataSource_
public BasicClientDataSource40 dataSource_
-
serverNameIP_
public java.lang.String serverNameIP_
-
portNumber_
public int portNumber_
-
commBufferSize_
public int commBufferSize_
-
resetConnectionAtFirstSql_
public boolean resetConnectionAtFirstSql_
-
-
Method Detail
-
createStatement
public java.sql.Statement createStatement() throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException- Specified by:
nativeSQLin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setAutoCommit
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException- Specified by:
setAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getAutoCommit
public boolean getAutoCommit() throws java.sql.SQLException- Specified by:
getAutoCommitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
commit
public void commit() throws java.sql.SQLException- Specified by:
commitin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
flowAutoCommit
public boolean flowAutoCommit() throws SqlException- Throws:
SqlException
-
willAutoCommitGenerateFlow
public boolean willAutoCommitGenerateFlow() throws SqlException- Throws:
SqlException
-
rollback
public void rollback() throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
transactionInProgress
public boolean transactionInProgress()
Check if there are uncommitted operations in the current transaction that prevent us from closing the connection.- Returns:
trueif the connection cannot be closed due to uncommitted operations in the transaction
-
closeResources
public void closeResources() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
isPhysicalConnClosed
public boolean isPhysicalConnClosed()
Return true if the physical connection is still open. Might be logically closed but available for reuse.- Returns:
- true if physical connection still open
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfacejava.sql.Connection
-
isClosedX
public boolean isClosedX()
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws java.sql.SQLException- Specified by:
setTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTransactionIsolation
public int getTransactionIsolation() throws java.sql.SQLException- Specified by:
getTransactionIsolationin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTransactionIsolationX
public int getTransactionIsolationX() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getTransactionID
public int getTransactionID()
Returns the ID of the active transaction for this connection.- Returns:
- the ID of the active transaction
-
getCurrentSchemaName
public java.lang.String getCurrentSchemaName() throws java.sql.SQLExceptionReturns the current schema (the schema that would be used for compilation. This is not part of the java.sql.Connection interface, and is only intended for use with statement caching.- Returns:
- the name of the current schema
- Throws:
java.sql.SQLException
-
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException- Specified by:
getWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
clearWarnings
public void clearWarnings() throws java.sql.SQLException- Specified by:
clearWarningsin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getMetaData
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException- Specified by:
getMetaDatain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setReadOnly
public void setReadOnly(boolean readOnly) throws java.sql.SQLException- Specified by:
setReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
isReadOnly
public boolean isReadOnly() throws java.sql.SQLException- Specified by:
isReadOnlyin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setCatalog
public void setCatalog(java.lang.String catalog) throws java.sql.SQLException- Specified by:
setCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getCatalog
public java.lang.String getCatalog() throws java.sql.SQLException- Specified by:
getCatalogin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getTypeMap
public java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap() throws java.sql.SQLException- Specified by:
getTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setTypeMap
public void setTypeMap(java.util.Map map) throws java.sql.SQLException- Specified by:
setTypeMapin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setHoldability
public void setHoldability(int holdability) throws java.sql.SQLException- Specified by:
setHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
getHoldability
public int getHoldability() throws java.sql.SQLException- Specified by:
getHoldabilityin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint() throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSavepoint
public java.sql.Savepoint setSavepoint(java.lang.String name) throws java.sql.SQLException- Specified by:
setSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
rollback
public void rollback(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
rollbackin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
releaseSavepoint
public void releaseSavepoint(java.sql.Savepoint savepoint) throws java.sql.SQLException- Specified by:
releaseSavepointin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
createStatement
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
createStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws java.sql.SQLException- Specified by:
prepareCallin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException- Specified by:
prepareStatementin interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
newSectionManager
public abstract SectionManager newSectionManager(Agent agent)
-
completeConnect
public final void completeConnect() throws SqlException- Throws:
SqlException
-
writeCommitSubstitute_
public abstract void writeCommitSubstitute_() throws SqlException- Throws:
SqlException
-
readCommitSubstitute_
public abstract void readCommitSubstitute_() throws SqlException- Throws:
SqlException
-
writeLocalXAStart_
public abstract void writeLocalXAStart_() throws SqlException- Throws:
SqlException
-
readLocalXAStart_
public abstract void readLocalXAStart_() throws SqlException- Throws:
SqlException
-
writeLocalXACommit_
public abstract void writeLocalXACommit_() throws SqlException- Throws:
SqlException
-
readLocalXACommit_
public abstract void readLocalXACommit_() throws SqlException- Throws:
SqlException
-
writeLocalCommit_
public abstract void writeLocalCommit_() throws SqlException- Throws:
SqlException
-
readLocalCommit_
public abstract void readLocalCommit_() throws SqlException- Throws:
SqlException
-
completeLocalCommit
public void completeLocalCommit()
- Specified by:
completeLocalCommitin interfaceConnectionCallbackInterface
-
writeLocalRollback_
public abstract void writeLocalRollback_() throws SqlException- Throws:
SqlException
-
readLocalRollback_
public abstract void readLocalRollback_() throws SqlException- Throws:
SqlException
-
completeLocalRollback
public void completeLocalRollback()
- Specified by:
completeLocalRollbackin interfaceConnectionCallbackInterface
-
writeLocalXARollback_
public abstract void writeLocalXARollback_() throws SqlException- Throws:
SqlException
-
readLocalXARollback_
public abstract void readLocalXARollback_() throws SqlException- Throws:
SqlException
-
writeTransactionStart
public void writeTransactionStart(ClientStatement statement) throws SqlException
- Throws:
SqlException
-
readTransactionStart
public void readTransactionStart() throws SqlException- Throws:
SqlException
-
completeAbnormalUnitOfWork
public void completeAbnormalUnitOfWork()
- Specified by:
completeAbnormalUnitOfWorkin interfaceConnectionCallbackInterface
-
completeAbnormalUnitOfWork
public void completeAbnormalUnitOfWork(UnitOfWorkListener uwl)
Rollback the UnitOfWorkListener specifically.- Specified by:
completeAbnormalUnitOfWorkin interfaceConnectionCallbackInterface- Parameters:
uwl- The UnitOfWorkListener to be rolled back.
-
completeChainBreakingDisconnect
public void completeChainBreakingDisconnect()
- Specified by:
completeChainBreakingDisconnectin interfaceConnectionCallbackInterface
-
completeSqlca
public void completeSqlca(Sqlca sqlca)
- Specified by:
completeSqlcain interfaceConnectionCallbackInterface
-
completePiggyBackIsolation
public void completePiggyBackIsolation(int pbIsolation)
Description copied from interface:ConnectionCallbackInterfaceCompletes piggy-backing of the new current isolation level by updating the cached copy in am.Connection.- Specified by:
completePiggyBackIsolationin interfaceConnectionCallbackInterface- Parameters:
pbIsolation- new isolation level from the server
-
completeInitialPiggyBackIsolation
public void completeInitialPiggyBackIsolation(int pbIsolation)
Sets the default isolation level of the connection upon connection initialization.Note that depending on the server version, the default isolation value may not be piggy-backed on the initialization flow. In that case, the default is assumed / hardcoded to be READ_COMMITTED.
- Parameters:
pbIsolation- isolation level as specified byjava.sql.Connection
-
completePiggyBackSchema
public void completePiggyBackSchema(java.lang.String pbSchema)
Description copied from interface:ConnectionCallbackInterfaceCompletes piggy-backing of the new current schema by updating the cached copy in am.Connection.- Specified by:
completePiggyBackSchemain interfaceConnectionCallbackInterface- Parameters:
pbSchema- new current schema from the server
-
completeInitialPiggyBackSchema
public void completeInitialPiggyBackSchema(java.lang.String pbSchema)
Sets the current schema upon connection initialization.- Parameters:
pbSchema- the schema name
-
reset
public void reset(LogWriter logWriter) throws SqlException
- Throws:
SqlException
-
lightReset
public void lightReset() throws SqlException- Throws:
SqlException
-
isXAConnection
public boolean isXAConnection()
-
getXAState
public int getXAState()
-
setXAState
public void setXAState(int state)
-
getServerVersion
public int getServerVersion()
-
createClob
public java.sql.Clob createClob() throws java.sql.SQLExceptionConstructs an object that implements theClobinterface. The object returned initially contains no data.- Specified by:
createClobin interfacejava.sql.Connection- Returns:
- An object that implements the
Clobinterface - Throws:
java.sql.SQLException- if an object that implements theClobinterface can not be constructed.
-
createBlob
public java.sql.Blob createBlob() throws java.sql.SQLExceptionConstructs an object that implements theBlobinterface. The object returned initially contains no data.- Specified by:
createBlobin interfacejava.sql.Connection- Returns:
- An object that implements the
Blobinterface - Throws:
java.sql.SQLException- if an object that implements the Blob interface can not be constructed.
-
isAborting
public boolean isAborting()
Return true if the connection is aborting
-
getSchema
public java.lang.String getSchema() throws java.sql.SQLExceptionGet the name of the current schema.- Specified by:
getSchemain interfacejava.sql.Connection- Throws:
java.sql.SQLException
-
setSchema
public void setSchema(java.lang.String schemaName) throws java.sql.SQLExceptionSet the default schema for the Connection.- Specified by:
setSchemain 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
-
getNetworkTimeout
public int getNetworkTimeout() throws java.sql.SQLException- Specified by:
getNetworkTimeoutin 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
-
-
DataMelt 3.0 © DataMelt by jWork.ORG