Package org.apache.derby.client.am
Class ClientConnection
java.lang.Object
org.apache.derby.client.am.ClientConnection
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
,ConnectionCallbackInterface
- Direct Known Subclasses:
NetConnection
public abstract class ClientConnection
extends Object
implements Connection, ConnectionCallbackInterface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private boolean
private boolean
boolean
private boolean
private int
int
(package private) final WeakHashMap
<UnitOfWorkListener, Void> private String
Cached copy of the schema name.private int
The default isolation level, enforced on connection resets.private static String
private static String
private static String
private static String
private int
private static final String
protected EncryptionManager
private ClientPreparedStatement
private int
Holdabilty for created statements.protected boolean
private static final int
private int
Cached copy of the isolation level.private final HashMap
<String, ClientPreparedStatement> protected boolean
private boolean
private CallableLocatorProcedures
Reference to object with prepared statements for calling the locator procedures.private int
protected boolean
(package private) final WeakHashMap
<ClientStatement, Void> int
boolean
(package private) boolean
private static final int
Constant indicating that isolation_ has not been updated through piggy-backing, (or that the previously stored value was invalidated, e.g. by an XA state change).private int
protected final String
private SqlWarning
static final int
XA_T0_NOT_ASSOCIATED
This connection is not currently associated with an XA transaction In this state commits will flow in autocommit mode.static final int
XA_T1_ASSOCIATED
In this state commits will not flow in autocommit mode.int
private int
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ClientConnection
(LogWriter logWriter, boolean isXAConn, BasicClientDataSource40 dataSource) protected
ClientConnection
(LogWriter logWriter, int driverManagerLoginTimeout, String serverName, int portNumber, String databaseName, Properties properties) protected
ClientConnection
(LogWriter logWriter, String user, String password, boolean isXAConn, BasicClientDataSource40 dataSource) protected
ClientConnection
(LogWriter logWriter, String user, String password, BasicClientDataSource40 dataSource) -
Method Summary
Modifier and TypeMethodDescriptionvoid
(package private) void
(package private) void
private void
protected abstract boolean
protected abstract boolean
protected void
Begin aborting the connectionprotected void
private void
(package private) void
Check if the transaction is in progress and the connection cannot be closed.void
private void
void
close()
(package private) void
closeForReuse
(boolean statementPooling) void
private void
private void
closeX()
void
commit()
void
void
Rollback the UnitOfWorkListener specifically.void
final void
void
completeInitialPiggyBackIsolation
(int pbIsolation) Sets the default isolation level of the connection upon connection initialization.void
completeInitialPiggyBackSchema
(String pbSchema) Sets the current schema upon connection initialization.void
void
void
completePiggyBackIsolation
(int pbIsolation) Completes piggy-backing of the new current isolation level by updating the cached copy in am.Connection.void
completePiggyBackSchema
(String pbSchema) Completes piggy-backing of the new current schema by updating the cached copy in am.Connection.protected void
completeReset
(boolean isDeferredReset, boolean closeStatementsOnClose, NetXAResource xares)
NOTE:The following comments are valid for the changes done as part of implementing statement caching only (see DERBY-3313 and linked issues).private void
Rollback the specific UnitOfWorkListener.void
completeSqlca
(Sqlca sqlca) (package private) void
Constructs an object that implements theBlob
interface.Constructs an object that implements theClob
interface.createStatement
(int resultSetType, int resultSetConcurrency) createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) private ClientStatement
createStatementX
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) protected abstract boolean
private int
downgradeResultSetType
(int resultSetType) protected void
finalize()
boolean
private void
private void
protected void
boolean
Returns the current schema (the schema that would be used for compilation.int
int
Get the name of the current schema.int
int
Returns the ID of the active transaction for this connection.int
int
int
(package private) final int
Return the holdabilty for the Connection.private void
initConnection
(LogWriter logWriter, BasicClientDataSource40 dataSource) boolean
Return true if the connection is abortingboolean
isClosed()
boolean
protected abstract boolean
boolean
Return true if the physical connection is still open.boolean
boolean
void
(package private) CallableLocatorProcedures
Get handle to the object that contains prepared statements for calling locator procedures for this connection.private void
markClosed
(boolean statementPooling) protected abstract void
private void
markClosedForReuse
(boolean statementPooling) private void
(package private) String
nativeSQLX
(String sql) protected abstract Agent
newAgent_
(LogWriter logWriter, int loginTimeout, String serverName, int portNumber, int clientSSLMode) protected abstract ClientCallableStatement
newCallableStatement_
(String sql, int type, int concurrency, int holdability) protected abstract ClientDatabaseMetaData
protected abstract ClientPreparedStatement
newPositionedUpdatePreparedStatement_
(String sql, Section section) protected abstract ClientPreparedStatement
newPreparedStatement_
(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) abstract SectionManager
newSectionManager
(Agent agent) protected abstract ClientStatement
newStatement_
(int type, int concurrency, int holdability) prepareCall
(String sql) prepareCall
(String sql, int resultSetType, int resultSetConcurrency) prepareCall
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) (package private) ClientCallableStatement
prepareCallX
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) (package private) ClientPreparedStatement
(package private) ClientCallableStatement
prepareMessageProc
(String sql) (package private) ClientPreparedStatement
preparePositionedUpdateStatement
(String sql, Section querySection) prepareStatement
(String sql) prepareStatement
(String sql, int autoGeneratedKeys) prepareStatement
(String sql, int[] columnIndexes) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement
(String sql, String[] columnNames) (package private) ClientPreparedStatement
prepareStatementX
(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) (package private) void
private void
(package private) void
abstract void
abstract void
abstract void
abstract void
abstract void
abstract void
private void
void
protected abstract void
protected abstract void
void
releaseSavepoint
(Savepoint savepoint) void
protected abstract void
protected abstract void
resetCallableStatement_
(ClientCallableStatement cs, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) protected void
resetConnection
(LogWriter logWriter) protected void
protected abstract void
resetPreparedStatement_
(ClientPreparedStatement ps, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) protected void
protected void
protected abstract void
resetStatement_
(ClientStatement statement, int type, int concurrency, int holdability) void
rollback()
void
protected abstract boolean
Checks whether the server supports locators for large objects.protected abstract boolean
Return true if the server supports nanoseconds in timestampsvoid
setAutoCommit
(boolean autoCommit) void
setCatalog
(String catalog) void
setHoldability
(int holdability) void
setNetworkTimeout
(Executor executor, int milliseconds) void
setReadOnly
(boolean readOnly) setSavepoint
(String name) private ClientSavepoint
setSavepointX
(ClientSavepoint savepoint) void
Set the default schema for the Connection.void
setTransactionIsolation
(int level) private void
setTransactionIsolationX
(int level) Set the transaction isolation level as specified.void
setTypeMap
(Map map) void
setXAState
(int state) protected abstract boolean
Finds out if the underlaying database connection supports session data caching.boolean
Check if there are uncommitted operations in the current transaction that prevent us from closing the connection.private int
translateIsolation
(String isolationStr) Translates the isolation level from a SQL string to the JDBC int valueboolean
(package private) void
private void
(package private) void
abstract void
abstract void
abstract void
abstract void
abstract void
abstract void
private void
void
writeTransactionStart
(ClientStatement statement) protected abstract void
protected abstract void
protected abstract void
writeXATransactionStart
(ClientStatement statement) Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, createArrayOf, createNClob, createSQLXML, createStruct, endRequest, getClientInfo, getClientInfo, isValid, setClientInfo, setClientInfo, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Field Details
-
agent_
-
databaseMetaData_
-
openStatements_
-
CommitAndRollbackListeners_
-
warnings_
-
INVALID_LOCATOR
private static final int INVALID_LOCATOR- See Also:
-
user_
-
retrieveMessageText_
boolean retrieveMessageText_ -
jdbcReadOnly_
private boolean jdbcReadOnly_ -
holdability
private int holdabilityHoldabilty for created statements. Only access through the holdability method to ensure the correct value is returned for an XA connection. -
databaseName_
-
productID_
-
encryptionManager_
-
isolationLevelPreparedStmts
-
getTransactionIsolationPrepStmt
-
open_
protected boolean open_ -
aborting_
private boolean aborting_ -
availableForReuse_
private boolean availableForReuse_ -
TRANSACTION_UNKNOWN
private static final int TRANSACTION_UNKNOWNConstant indicating that isolation_ has not been updated through piggy-backing, (or that the previously stored value was invalidated, e.g. by an XA state change).- See Also:
-
isolation_
private int isolation_Cached copy of the isolation level. Kept in sync with server through piggy-backing. -
defaultIsolation
private int defaultIsolationThe default isolation level, enforced on connection resets.Note that this value may be changed upon connection initialization in the future, as the server can piggy-back the isolation level.
-
currentSchemaName_
Cached copy of the schema name. Updated through piggy-backing and used to implement statement caching. -
autoCommit_
public boolean autoCommit_ -
inUnitOfWork_
protected boolean inUnitOfWork_ -
accumulated440ForMessageProcFailure_
private boolean accumulated440ForMessageProcFailure_ -
accumulated444ForMessageProcFailure_
private boolean accumulated444ForMessageProcFailure_ -
transactionID_
private int transactionID_ -
isXAConnection_
protected boolean isXAConnection_ -
XA_T0_NOT_ASSOCIATED
public static final int XA_T0_NOT_ASSOCIATEDXA_T0_NOT_ASSOCIATED
This connection is not currently associated with an XA transaction In this state commits will flow in autocommit mode.- See Also:
-
XA_T1_ASSOCIATED
public static final int XA_T1_ASSOCIATEDXA_T1_ASSOCIATED
In this state commits will not flow in autocommit mode.- See Also:
-
xaState_
private int xaState_ -
xaHostVersion_
public int xaHostVersion_ -
loginTimeout_
private int loginTimeout_ -
dataSource_
-
serverNameIP_
-
portNumber_
public int portNumber_ -
clientSSLMode_
private int clientSSLMode_ -
clientCursorNameCache_
-
commBufferSize_
public int commBufferSize_ -
resetConnectionAtFirstSql_
public boolean resetConnectionAtFirstSql_ -
DERBY_TRANSACTION_REPEATABLE_READ
-
DERBY_TRANSACTION_SERIALIZABLE
-
DERBY_TRANSACTION_READ_COMMITTED
-
DERBY_TRANSACTION_READ_UNCOMMITTED
-
dncGeneratedSavepointId_
private int dncGeneratedSavepointId_ -
dncGeneratedSavepointNamePrefix__
- See Also:
-
lobProcs
Reference to object with prepared statements for calling the locator procedures. Makes it possible to reuse prepared statements within the connection.
-
-
Constructor Details
-
ClientConnection
protected ClientConnection(LogWriter logWriter, String user, String password, BasicClientDataSource40 dataSource) throws SqlException - Throws:
SqlException
-
ClientConnection
protected ClientConnection(LogWriter logWriter, String user, String password, boolean isXAConn, BasicClientDataSource40 dataSource) throws SqlException - Throws:
SqlException
-
ClientConnection
protected ClientConnection(LogWriter logWriter, boolean isXAConn, BasicClientDataSource40 dataSource) throws SqlException - Throws:
SqlException
-
ClientConnection
protected ClientConnection(LogWriter logWriter, int driverManagerLoginTimeout, String serverName, int portNumber, String databaseName, Properties properties) throws SqlException - Throws:
SqlException
-
-
Method Details
-
initConnection
private void initConnection(LogWriter logWriter, BasicClientDataSource40 dataSource) throws SqlException - Throws:
SqlException
-
resetConnection
- Throws:
SqlException
-
finalize
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
preparePositionedUpdateStatement
ClientPreparedStatement preparePositionedUpdateStatement(String sql, Section querySection) throws SqlException - Throws:
SqlException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareDynamicCatalogQuery
- Throws:
SqlException
-
nativeSQL
- Specified by:
nativeSQL
in interfaceConnection
- Throws:
SQLException
-
nativeSQLX
- Throws:
SqlException
-
allowLocalCommitRollback_
- Throws:
SqlException
-
setAutoCommit
- Specified by:
setAutoCommit
in interfaceConnection
- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommit
in interfaceConnection
- Throws:
SQLException
-
commit
- Specified by:
commit
in interfaceConnection
- Throws:
SQLException
-
checkForInvalidXAStateOnCommitOrRollback
- Throws:
SqlException
-
flowCommit
- Throws:
SqlException
-
flowAutoCommit
- Throws:
SqlException
-
willAutoCommitGenerateFlow
- Throws:
SqlException
-
writeAutoCommit
- Throws:
SqlException
-
writeCommit
- Throws:
SqlException
-
readAutoCommit
- Throws:
SqlException
-
readCommit
- Throws:
SqlException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
-
flowRollback
- Throws:
SqlException
-
writeRollback
- Throws:
SqlException
-
readRollback
- Throws:
SqlException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceConnection
- Throws:
SQLException
-
checkForTransactionInProgress
Check if the transaction is in progress and the connection cannot be closed.- Throws:
SqlException
- if the connection cannot be closed because the transaction is active
-
transactionInProgress
public boolean transactionInProgress()Check if there are uncommitted operations in the current transaction that prevent us from closing the connection.- Returns:
true
if the connection cannot be closed due to uncommitted operations in the transaction
-
closeX
- Throws:
SQLException
-
closeResources
- Throws:
SQLException
-
closeResourcesX
- Throws:
SQLException
-
isGlobalPending_
protected abstract boolean isGlobalPending_() -
closeForReuse
- Throws:
SqlException
-
flowClose
- Throws:
SqlException
-
markClosed_
protected abstract void markClosed_() -
markClosed
private void markClosed(boolean statementPooling) -
markClosedForReuse
private void markClosedForReuse(boolean statementPooling) -
markStatementsClosed
private void markStatementsClosed() -
writeCloseStatements
- Throws:
SqlException
-
readCloseStatements
- Throws:
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:
isClosed
in interfaceConnection
-
isClosedX
public boolean isClosedX() -
setTransactionIsolation
- Specified by:
setTransactionIsolation
in interfaceConnection
- Throws:
SQLException
-
setTransactionIsolationX
Set the transaction isolation level as specified.If this method is called during a transaction, the result is implementation-defined.
Information about Derby specific isolation level handling:
- REPEATABLE_READ = JDBC: TRANSACTION_SERIALIZABLE, DERBY: RR, PROTOCOL: repeatable read
- READ_STABILITY = JDBC: TRANSACTION_REPEATABLE_READ, DERBY: RS, PROTOCOL: All
- CURSOR_STABILITY = JDBC: TRANSACTION_READ_COMMITTED, DERBY: CS, PROTOCOL: Cursor stability
- UNCOMMITTED_READ = JDBC: TRANSACTION_READ_UNCOMMITTED, DERBY: UR, PROTOCOL: Change
- NO_COMMIT = JDBC: TRANSACTION_NONE, DERBY: NC, PROTOCOL: No commit
- Throws:
SqlException
-
supportsSessionDataCaching
protected abstract boolean supportsSessionDataCaching()Finds out if the underlaying database connection supports session data caching.- Returns:
- true if sessionData is supported
-
serverSupportsLocators
protected abstract boolean serverSupportsLocators()Checks whether the server supports locators for large objects. Note that even though the server supports LOB locators, the database that is accessed through the server may not have the necessary stored procedures to support LOB locators (e.g., because the database is soft upgraded from an earlier version).- Returns:
true
if LOB locators are supported.
-
serverSupportsTimestampNanoseconds
protected abstract boolean serverSupportsTimestampNanoseconds()Return true if the server supports nanoseconds in timestamps -
getTransactionIsolation
- Specified by:
getTransactionIsolation
in interfaceConnection
- Throws:
SQLException
-
getTransactionIsolationX
- Throws:
SQLException
-
getTransactionID
public int getTransactionID()Returns the ID of the active transaction for this connection.- Returns:
- the ID of the active transaction
-
getCurrentSchemaName
Returns 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:
SQLException
-
translateIsolation
Translates the isolation level from a SQL string to the JDBC int value- Parameters:
isolationStr
- SQL isolation string- Returns:
- isolation level as a JDBC integer value
-
getWarnings
- Specified by:
getWarnings
in interfaceConnection
- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceConnection
- Throws:
SQLException
-
clearWarningsX
- Throws:
SqlException
-
getMetaData
- Specified by:
getMetaData
in interfaceConnection
- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnly
in interfaceConnection
- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnly
in interfaceConnection
- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalog
in interfaceConnection
- Throws:
SQLException
-
getCatalog
- Specified by:
getCatalog
in interfaceConnection
- Throws:
SQLException
-
createStatement
- Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareMessageProc
- Throws:
SqlException
-
downgradeResultSetType
private int downgradeResultSetType(int resultSetType) -
getTypeMap
- Specified by:
getTypeMap
in interfaceConnection
- Throws:
SQLException
-
setTypeMap
- Specified by:
setTypeMap
in interfaceConnection
- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldability
in interfaceConnection
- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldability
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
setSavepointX
- Throws:
SQLException
-
rollback
- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepoint
in interfaceConnection
- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatement
in interfaceConnection
- Throws:
SQLException
-
createStatementX
private ClientStatement createStatementX(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SqlException - Throws:
SqlException
-
resetStatement
- Throws:
SqlException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatementX
ClientPreparedStatement prepareStatementX(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Throws:
SqlException
-
resetPrepareStatement
- Throws:
SqlException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCallX
ClientCallableStatement prepareCallX(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SqlException - Throws:
SqlException
-
resetPrepareCall
- Throws:
SqlException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
allowCloseInUOW_
protected abstract boolean allowCloseInUOW_() -
doCloseStatementsOnClose_
protected abstract boolean doCloseStatementsOnClose_() -
newSectionManager
-
newAgent_
protected abstract Agent newAgent_(LogWriter logWriter, int loginTimeout, String serverName, int portNumber, int clientSSLMode) throws SqlException - Throws:
SqlException
-
newDatabaseMetaData_
-
newStatement_
protected abstract ClientStatement newStatement_(int type, int concurrency, int holdability) throws SqlException - Throws:
SqlException
-
resetStatement_
protected abstract void resetStatement_(ClientStatement statement, int type, int concurrency, int holdability) throws SqlException - Throws:
SqlException
-
newPositionedUpdatePreparedStatement_
protected abstract ClientPreparedStatement newPositionedUpdatePreparedStatement_(String sql, Section section) throws SqlException - Throws:
SqlException
-
newPreparedStatement_
protected abstract ClientPreparedStatement newPreparedStatement_(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Throws:
SqlException
-
resetPreparedStatement_
protected abstract void resetPreparedStatement_(ClientPreparedStatement ps, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes) throws SqlException - Throws:
SqlException
-
newCallableStatement_
protected abstract ClientCallableStatement newCallableStatement_(String sql, int type, int concurrency, int holdability) throws SqlException - Throws:
SqlException
-
resetCallableStatement_
protected abstract void resetCallableStatement_(ClientCallableStatement cs, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SqlException - Throws:
SqlException
-
completeConnect
- Throws:
SqlException
-
writeCommitSubstitute_
- Throws:
SqlException
-
readCommitSubstitute_
- Throws:
SqlException
-
writeLocalXAStart_
- Throws:
SqlException
-
readLocalXAStart_
- Throws:
SqlException
-
writeLocalXACommit_
- Throws:
SqlException
-
writeXACommit_
- Throws:
SqlException
-
readLocalXACommit_
- Throws:
SqlException
-
readXACommit_
- Throws:
SqlException
-
writeLocalCommit_
- Throws:
SqlException
-
readLocalCommit_
- Throws:
SqlException
-
writeXATransactionStart
- Throws:
SqlException
-
completeLocalCommit
public void completeLocalCommit()- Specified by:
completeLocalCommit
in interfaceConnectionCallbackInterface
-
writeLocalRollback_
- Throws:
SqlException
-
readLocalRollback_
- Throws:
SqlException
-
completeLocalRollback
public void completeLocalRollback()- Specified by:
completeLocalRollback
in interfaceConnectionCallbackInterface
-
completeSpecificRollback
Rollback the specific UnitOfWorkListener.- Parameters:
uwl
- The UnitOfWorkLitener to be rolled back
-
writeLocalXARollback_
- Throws:
SqlException
-
writeXARollback_
- Throws:
SqlException
-
readLocalXARollback_
- Throws:
SqlException
-
readXARollback_
- Throws:
SqlException
-
writeTransactionStart
- Throws:
SqlException
-
readTransactionStart
- Throws:
SqlException
-
completeTransactionStart
void completeTransactionStart() -
completeAbnormalUnitOfWork
public void completeAbnormalUnitOfWork()- Specified by:
completeAbnormalUnitOfWork
in interfaceConnectionCallbackInterface
-
completeAbnormalUnitOfWork
Rollback the UnitOfWorkListener specifically.- Specified by:
completeAbnormalUnitOfWork
in interfaceConnectionCallbackInterface
- Parameters:
uwl
- The UnitOfWorkListener to be rolled back.
-
completeChainBreakingDisconnect
public void completeChainBreakingDisconnect()- Specified by:
completeChainBreakingDisconnect
in interfaceConnectionCallbackInterface
-
completeSqlca
- Specified by:
completeSqlca
in interfaceConnectionCallbackInterface
-
completePiggyBackIsolation
public void completePiggyBackIsolation(int pbIsolation) Description copied from interface:ConnectionCallbackInterface
Completes piggy-backing of the new current isolation level by updating the cached copy in am.Connection.- Specified by:
completePiggyBackIsolation
in 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
Description copied from interface:ConnectionCallbackInterface
Completes piggy-backing of the new current schema by updating the cached copy in am.Connection.- Specified by:
completePiggyBackSchema
in interfaceConnectionCallbackInterface
- Parameters:
pbSchema
- new current schema from the server
-
completeInitialPiggyBackSchema
Sets the current schema upon connection initialization.- Parameters:
pbSchema
- the schema name
-
reset
- Throws:
SqlException
-
lightReset
- Throws:
SqlException
-
reset_
- Throws:
SqlException
-
completeReset
protected void completeReset(boolean isDeferredReset, boolean closeStatementsOnClose, NetXAResource xares) throws SqlException
NOTE:The following comments are valid for the changes done as part of implementing statement caching only (see DERBY-3313 and linked issues).We don't reset the isolation level to unknown unconditionally, as this forces us to go to the server all the time. Since the value should now be valid (DERBY-3192), we check if it has been changed from the default.
- Parameters:
closeStatementsOnClose
- is used to differentiate between cases where statement pooling is enabled or not. Iftrue
, it means statement pooling is disabled and the statements are fully reset, which includes a re-prepare. Iffalse
, statement pooling is enabled, and a more lightweight reset procedure is used.- Throws:
SqlException
-
locatorProcedureCall
CallableLocatorProcedures locatorProcedureCall()Get handle to the object that contains prepared statements for calling locator procedures for this connection. The object will be created on the first invocation. An example of how to call a stored procedure via this method:connection.locatorProcedureCall().blobReleaseLocator(locator);
- Returns:
- object with prepared statements for calling locator procedures
-
checkForClosedConnection
- Throws:
SqlException
-
isXAConnection
public boolean isXAConnection() -
getXAState
public int getXAState() -
setXAState
public void setXAState(int state) -
accumulateWarning
-
accumulate440WarningForMessageProcFailure
-
accumulate444WarningForMessageProcFailure
-
getServerVersion
public int getServerVersion() -
holdability
final int holdability()Return the holdabilty for the Connection. Matches the embedded driver in the restriction that while in a global (XA) transaction the holdability is CLOSE_CURSORS_AT_COMMIT. Otherwise return the holdability set by the user. -
createClob
Constructs an object that implements theClob
interface. The object returned initially contains no data.- Specified by:
createClob
in interfaceConnection
- Returns:
- An object that implements the
Clob
interface - Throws:
SQLException
- if an object that implements theClob
interface can not be constructed.
-
createBlob
Constructs an object that implements theBlob
interface. The object returned initially contains no data.- Specified by:
createBlob
in interfaceConnection
- Returns:
- An object that implements the
Blob
interface - Throws:
SQLException
- if an object that implements the Blob interface can not be constructed.
-
isAborting
public boolean isAborting()Return true if the connection is aborting -
beginAborting
protected void beginAborting()Begin aborting the connection -
getSchema
Get the name of the current schema.- Specified by:
getSchema
in interfaceConnection
- Throws:
SQLException
-
setSchema
Set the default schema for the Connection.- Specified by:
setSchema
in interfaceConnection
- Throws:
SQLException
-
abort
- Specified by:
abort
in interfaceConnection
- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-