org.apache.derby.client.am
Class Connection

java.lang.Object
  extended by org.apache.derby.client.am.Connection
All Implemented Interfaces:
java.sql.Connection, java.sql.Wrapper, ConnectionCallbackInterface
Direct Known Subclasses:
NetConnection

public abstract class Connection
extends java.lang.Object
implements java.sql.Connection, ConnectionCallbackInterface


Field Summary
private  boolean accumulated440ForMessageProcFailure_
           
private  boolean accumulated444ForMessageProcFailure_
           
 Agent agent_
           
 boolean autoCommit_
           
private  boolean availableForReuse_
           
(package private)  java.util.Hashtable clientCursorNameCache_
           
 int clientSSLMode_
           
 int commBufferSize_
           
(package private)  java.util.WeakHashMap CommitAndRollbackListeners_
           
private  java.lang.String currentSchemaName_
          Cached copy of the schema name.
 DatabaseMetaData databaseMetaData_
           
 java.lang.String databaseName_
           
 ClientBaseDataSource dataSource_
           
private static java.lang.String DERBY_TRANSACTION_READ_COMMITTED
           
private static java.lang.String DERBY_TRANSACTION_READ_UNCOMMITTED
           
private static java.lang.String DERBY_TRANSACTION_REPEATABLE_READ
           
private static java.lang.String DERBY_TRANSACTION_SERIALIZABLE
           
 int dncGeneratedSavepointId_
           
static java.lang.String dncGeneratedSavepointNamePrefix__
           
protected  EncryptionManager encryptionManager_
           
private  Statement getTransactionIsolationStmt
           
private  int holdability
          Holdabilty for created statements.
protected  boolean inUnitOfWork_
           
private static int INVALID_LOCATOR
           
private  int isolation_
          Cached copy of the isolation level.
protected  boolean isXAConnection_
           
protected  boolean jdbcReadOnly_
           
private  CallableLocatorProcedures lobProcs
          Reference to object with prepared statements for calling the locator procedures.
 int loginTimeout_
           
protected  boolean open_
           
(package private)  java.util.WeakHashMap openStatements_
           
 int portNumber_
           
 java.lang.String productID_
           
 boolean resetConnectionAtFirstSql_
           
 boolean retrieveMessageText_
           
 java.lang.String serverNameIP_
           
private  Statement setTransactionIsolationStmt
           
private static int TRANSACTION_UNKNOWN
          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 transactionID_
           
protected  java.lang.String user_
           
private  SqlWarning warnings_
           
static int XA_T0_NOT_ASSOCIATED
          XA_T0_NOT_ASSOCIATED This connection is not currently associated with an XA transaction In this state commits will flow in autocommit mode.
static int XA_T1_ASSOCIATED
          XA_T1_ASSOCIATED In this state commits will not flow in autocommit mode.
 int xaHostVersion_
           
private  int xaState_
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Constructor Summary
protected Connection(LogWriter logWriter, boolean isXAConn, ClientBaseDataSource dataSource)
           
protected Connection(LogWriter logWriter, int driverManagerLoginTimeout, java.lang.String serverName, int portNumber, java.lang.String databaseName, java.util.Properties properties)
           
protected Connection(LogWriter logWriter, java.lang.String user, java.lang.String password, boolean isXAConn, ClientBaseDataSource dataSource)
           
protected Connection(LogWriter logWriter, java.lang.String user, java.lang.String password, ClientBaseDataSource dataSource)
           
 
Method Summary
 void accumulate440WarningForMessageProcFailure(SqlWarning e)
           
 void accumulate444WarningForMessageProcFailure(SqlWarning e)
           
 void accumulateWarning(SqlWarning e)
           
abstract  void addSpecialRegisters(java.lang.String s)
           
protected abstract  boolean allowCloseInUOW_()
           
protected abstract  boolean allowLocalCommitRollback_()
           
protected  void checkForClosedConnection()
           
private  void checkForInvalidXAStateOnCommitOrRollback()
           
(package private)  void checkForTransactionInProgress()
          Check if the transaction is in progress and the connection cannot be closed.
 void clearWarnings()
           
 void clearWarningsX()
           
 void close()
           
 void closeForReuse(boolean statementPooling)
           
 void closeResources()
           
private  void closeResourcesX()
           
 void closeX()
           
 void commit()
           
 void completeAbnormalUnitOfWork()
           
 void completeAbnormalUnitOfWork(UnitOfWorkListener uwl)
          Rollback the UnitOfWorkListener specifically.
 void completeChainBreakingDisconnect()
           
 void completeConnect()
           
 void completeLocalCommit()
           
 void completeLocalRollback()
           
 void completePiggyBackIsolation(int pbIsolation)
          Completes piggy-backing of the new current isolation level by updating the cached copy in am.Connection.
 void completePiggyBackSchema(java.lang.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)
          
NOTE:
The following comments are valid for the changes done as part of implementing statement caching only (see DERBY-3313 and linked issues).
 void completeSpecificRollback(UnitOfWorkListener uwl)
          Rollback the specific UnitOfWorkListener.
 void completeSqlca(Sqlca sqlca)
           
(package private)  void completeTransactionStart()
           
 java.sql.Blob createBlob()
          Constructs an object that implements the Blob interface.
 java.sql.Clob createClob()
          Constructs an object that implements the Clob interface.
 java.sql.Statement createStatement()
           
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
           
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
private  Statement createStatementX(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
protected abstract  boolean doCloseStatementsOnClose_()
           
private  int downgradeResultSetType(int resultSetType)
           
protected  void finalize()
           
 boolean flowAutoCommit()
           
private  void flowClose()
           
 void flowCommit()
           
protected  void flowRollback()
           
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
           
 java.lang.String getCurrentSchemaName()
          Returns the current schema (the schema that would be used for compilation.
 int getHoldability()
           
 java.sql.DatabaseMetaData getMetaData()
           
 int getServerVersion()
           
 int getTransactionID()
          Returns the ID of the active transaction for this connection.
 int getTransactionIsolation()
           
 java.util.Map getTypeMap()
           
 java.sql.SQLWarning getWarnings()
           
 int getXAState()
           
(package private)  int holdability()
          Return the holdabilty for the Connection.
protected  void initConnection(LogWriter logWriter, ClientBaseDataSource dataSource)
           
 boolean isClosed()
           
 boolean isClosedX()
           
protected abstract  boolean isGlobalPending_()
           
 boolean isPhysicalConnClosed()
          Return true if the physical connection is still open.
 boolean isReadOnly()
           
 boolean isXAConnection()
           
 void lightReset()
           
(package private)  CallableLocatorProcedures locatorProcedureCall()
          Get handle to the object that contains prepared statements for calling locator procedures for this connection.
protected abstract  void markClosed_()
           
 void markClosed(boolean statementPooling)
           
private  void markClosedForReuse(boolean statementPooling)
           
private  void markStatementsClosed()
           
 java.lang.String nativeSQL(java.lang.String sql)
           
 java.lang.String nativeSQLX(java.lang.String sql)
           
protected abstract  Agent newAgent_(LogWriter logWriter, int loginTimeout, java.lang.String serverName, int portNumber, int clientSSLMode)
           
protected abstract  CallableStatement newCallableStatement_(java.lang.String sql, int type, int concurrency, int holdability)
           
protected abstract  DatabaseMetaData newDatabaseMetaData_()
           
protected abstract  PreparedStatement newPositionedUpdatePreparedStatement_(java.lang.String sql, Section section)
           
protected abstract  PreparedStatement newPreparedStatement_(java.lang.String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, java.lang.String[] columnNames, int[] columnIndexes)
           
abstract  SectionManager newSectionManager(java.lang.String collection, Agent agent, java.lang.String databaseName)
           
protected abstract  Statement newStatement_(int type, int concurrency, int holdability)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
(package private)  CallableStatement prepareCallX(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
(package private)  PreparedStatement prepareDynamicCatalogQuery(java.lang.String sql)
           
 CallableStatement prepareMessageProc(java.lang.String sql)
           
 PreparedStatement preparePositionedUpdateStatement(java.lang.String sql, Section querySection)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int autoGeneratedKeys)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int[] columnIndexes)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, java.lang.String[] columnNames)
           
(package private)  PreparedStatement prepareStatementX(java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, java.lang.String[] columnNames, int[] columnIndexes)
           
(package private)  void readAutoCommit()
           
private  void readCloseStatements()
           
 void readCommit()
           
abstract  void readCommitSubstitute_()
           
abstract  void readLocalCommit_()
           
abstract  void readLocalRollback_()
           
abstract  void readLocalXACommit_()
           
abstract  void readLocalXARollback_()
           
abstract  void readLocalXAStart_()
           
 void readRollback()
           
 void readTransactionStart()
           
protected abstract  void readXACommit_()
           
protected abstract  void readXARollback_()
           
 void releaseSavepoint(java.sql.Savepoint savepoint)
           
protected abstract  void reset_(LogWriter logWriter)
           
 void reset(LogWriter logWriter)
           
protected abstract  void resetCallableStatement_(CallableStatement cs, java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
           
protected  void resetConnection(LogWriter logWriter)
           
protected  void resetPrepareCall(CallableStatement cs)
           
protected abstract  void resetPreparedStatement_(PreparedStatement ps, java.lang.String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, java.lang.String[] columnNames, int[] columnIndexes)
           
protected  void resetPrepareStatement(PreparedStatement ps)
           
protected abstract  void resetStatement_(Statement statement, int type, int concurrency, int holdability)
           
protected  void resetStatement(Statement s)
           
 void rollback()
           
 void rollback(java.sql.Savepoint savepoint)
           
protected abstract  boolean serverSupportsLocators()
          Checks whether the server supports locators for large objects.
protected abstract  boolean serverSupportsTimestampNanoseconds()
          Return true if the server supports nanoseconds in timestamps
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(java.lang.String catalog)
           
 void setHoldability(int holdability)
           
 void setInUnitOfWork(boolean inUnitOfWork)
           
 void setReadOnly(boolean readOnly)
           
 java.sql.Savepoint setSavepoint()
           
 java.sql.Savepoint setSavepoint(java.lang.String name)
           
private  Savepoint setSavepointX(Savepoint savepoint)
           
 void setTransactionIsolation(int level)
           
private  void setTransactionIsolationX(int level)
          Set the transaction isolation level as specified.
 void setTypeMap(java.util.Map map)
           
 void setXAState(int state)
           
protected abstract  boolean supportsSessionDataCaching()
          Finds out if the underlaying database connection supports session data caching.
 boolean transactionInProgress()
          Check if there are uncommitted operations in the current transaction that prevent us from closing the connection.
private  int translateIsolation(java.lang.String isolationStr)
          Translates the isolation level from a SQL string to the JDBC int value
 boolean willAutoCommitGenerateFlow()
           
(package private)  void writeAutoCommit()
           
private  void writeCloseStatements()
           
 void writeCommit()
           
abstract  void writeCommitSubstitute_()
           
abstract  void writeLocalCommit_()
           
abstract  void writeLocalRollback_()
           
abstract  void writeLocalXACommit_()
           
abstract  void writeLocalXARollback_()
           
abstract  void writeLocalXAStart_()
           
 void writeRollback()
           
 void writeTransactionStart(Statement statement)
           
protected abstract  void writeXACommit_()
           
protected abstract  void writeXARollback_()
           
protected abstract  void writeXATransactionStart(Statement 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
createArrayOf, createNClob, createSQLXML, createStruct, getClientInfo, getClientInfo, isValid, setClientInfo, setClientInfo
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Field Detail

agent_

public Agent agent_

databaseMetaData_

public DatabaseMetaData databaseMetaData_

openStatements_

final java.util.WeakHashMap openStatements_

CommitAndRollbackListeners_

final java.util.WeakHashMap CommitAndRollbackListeners_

warnings_

private SqlWarning warnings_

INVALID_LOCATOR

private static final int INVALID_LOCATOR
See Also:
Constant Field Values

user_

protected final java.lang.String user_

retrieveMessageText_

public boolean retrieveMessageText_

jdbcReadOnly_

protected boolean jdbcReadOnly_

holdability

private int holdability
Holdabilty for created statements. Only access through the holdability method to ensure the correct value is returned for an XA connection.


databaseName_

public java.lang.String databaseName_

productID_

public java.lang.String productID_

encryptionManager_

protected EncryptionManager encryptionManager_

setTransactionIsolationStmt

private Statement setTransactionIsolationStmt

getTransactionIsolationStmt

private Statement getTransactionIsolationStmt

open_

protected boolean open_

availableForReuse_

private boolean availableForReuse_

TRANSACTION_UNKNOWN

private static final int TRANSACTION_UNKNOWN
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).

See Also:
Constant Field Values

isolation_

private int isolation_
Cached copy of the isolation level. Kept in sync with server through piggy-backing.


currentSchemaName_

private java.lang.String 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_ASSOCIATED
XA_T0_NOT_ASSOCIATED This 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_ASSOCIATED In this state commits will not flow in autocommit mode.

See Also:
Constant Field Values

xaState_

private int xaState_

xaHostVersion_

public int xaHostVersion_

loginTimeout_

public int loginTimeout_

dataSource_

public ClientBaseDataSource dataSource_

serverNameIP_

public java.lang.String serverNameIP_

portNumber_

public int portNumber_

clientSSLMode_

public int clientSSLMode_

clientCursorNameCache_

java.util.Hashtable clientCursorNameCache_

commBufferSize_

public int commBufferSize_

resetConnectionAtFirstSql_

public boolean resetConnectionAtFirstSql_

DERBY_TRANSACTION_REPEATABLE_READ

private static java.lang.String DERBY_TRANSACTION_REPEATABLE_READ

DERBY_TRANSACTION_SERIALIZABLE

private static java.lang.String DERBY_TRANSACTION_SERIALIZABLE

DERBY_TRANSACTION_READ_COMMITTED

private static java.lang.String DERBY_TRANSACTION_READ_COMMITTED

DERBY_TRANSACTION_READ_UNCOMMITTED

private static java.lang.String DERBY_TRANSACTION_READ_UNCOMMITTED

dncGeneratedSavepointId_

public int dncGeneratedSavepointId_

dncGeneratedSavepointNamePrefix__

public static final java.lang.String dncGeneratedSavepointNamePrefix__
See Also:
Constant Field Values

lobProcs

private CallableLocatorProcedures lobProcs
Reference to object with prepared statements for calling the locator procedures. Makes it possible to reuse prepared statements within the connection.

Constructor Detail

Connection

protected Connection(LogWriter logWriter,
                     java.lang.String user,
                     java.lang.String password,
                     ClientBaseDataSource dataSource)
              throws SqlException
Throws:
SqlException

Connection

protected Connection(LogWriter logWriter,
                     java.lang.String user,
                     java.lang.String password,
                     boolean isXAConn,
                     ClientBaseDataSource dataSource)
              throws SqlException
Throws:
SqlException

Connection

protected Connection(LogWriter logWriter,
                     boolean isXAConn,
                     ClientBaseDataSource dataSource)
              throws SqlException
Throws:
SqlException

Connection

protected Connection(LogWriter logWriter,
                     int driverManagerLoginTimeout,
                     java.lang.String serverName,
                     int portNumber,
                     java.lang.String databaseName,
                     java.util.Properties properties)
              throws SqlException
Throws:
SqlException
Method Detail

initConnection

protected void initConnection(LogWriter logWriter,
                              ClientBaseDataSource dataSource)
                       throws SqlException
Throws:
SqlException

resetConnection

protected void resetConnection(LogWriter logWriter)
                        throws SqlException
Throws:
SqlException

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

preparePositionedUpdateStatement

public PreparedStatement preparePositionedUpdateStatement(java.lang.String sql,
                                                          Section querySection)
                                                   throws SqlException
Throws:
SqlException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareDynamicCatalogQuery

PreparedStatement prepareDynamicCatalogQuery(java.lang.String sql)
                                       throws SqlException
Throws:
SqlException

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Specified by:
nativeSQL in interface java.sql.Connection
Throws:
java.sql.SQLException

nativeSQLX

public java.lang.String nativeSQLX(java.lang.String sql)
                            throws SqlException
Throws:
SqlException

allowLocalCommitRollback_

protected abstract boolean allowLocalCommitRollback_()
                                              throws SqlException
Throws:
SqlException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Specified by:
setAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Specified by:
getAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException
Specified by:
commit in interface java.sql.Connection
Throws:
java.sql.SQLException

checkForInvalidXAStateOnCommitOrRollback

private void checkForInvalidXAStateOnCommitOrRollback()
                                               throws SqlException
Throws:
SqlException

flowCommit

public void flowCommit()
                throws SqlException
Throws:
SqlException

flowAutoCommit

public boolean flowAutoCommit()
                       throws SqlException
Throws:
SqlException

willAutoCommitGenerateFlow

public boolean willAutoCommitGenerateFlow()
                                   throws SqlException
Throws:
SqlException

writeAutoCommit

void writeAutoCommit()
               throws SqlException
Throws:
SqlException

writeCommit

public void writeCommit()
                 throws SqlException
Throws:
SqlException

readAutoCommit

void readAutoCommit()
              throws SqlException
Throws:
SqlException

readCommit

public void readCommit()
                throws SqlException
Throws:
SqlException

rollback

public void rollback()
              throws java.sql.SQLException
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException

flowRollback

protected void flowRollback()
                     throws SqlException
Throws:
SqlException

writeRollback

public void writeRollback()
                   throws SqlException
Throws:
SqlException

readRollback

public void readRollback()
                  throws SqlException
Throws:
SqlException

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Connection
Throws:
java.sql.SQLException

checkForTransactionInProgress

void checkForTransactionInProgress()
                             throws SqlException
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

public void closeX()
            throws java.sql.SQLException
Throws:
java.sql.SQLException

closeResources

public void closeResources()
                    throws java.sql.SQLException
Throws:
java.sql.SQLException

closeResourcesX

private void closeResourcesX()
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

isGlobalPending_

protected abstract boolean isGlobalPending_()

closeForReuse

public void closeForReuse(boolean statementPooling)
                   throws SqlException
Throws:
SqlException

flowClose

private void flowClose()
                throws SqlException
Throws:
SqlException

markClosed_

protected abstract void markClosed_()

markClosed

public void markClosed(boolean statementPooling)

markClosedForReuse

private void markClosedForReuse(boolean statementPooling)

markStatementsClosed

private void markStatementsClosed()

writeCloseStatements

private void writeCloseStatements()
                           throws SqlException
Throws:
SqlException

readCloseStatements

private void readCloseStatements()
                          throws SqlException
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 interface java.sql.Connection

isClosedX

public boolean isClosedX()

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Specified by:
setTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException

setTransactionIsolationX

private void setTransactionIsolationX(int level)
                               throws SqlException
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:

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

public int getTransactionIsolation()
                            throws java.sql.SQLException
Specified by:
getTransactionIsolation in interface java.sql.Connection
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.SQLException
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:
java.sql.SQLException

translateIsolation

private int translateIsolation(java.lang.String isolationStr)
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

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Specified by:
getWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Specified by:
clearWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException

clearWarningsX

public void clearWarningsX()
                    throws SqlException
Throws:
SqlException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Specified by:
getMetaData in interface java.sql.Connection
Throws:
java.sql.SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Specified by:
setReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Specified by:
isReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Specified by:
setCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Specified by:
getCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.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:
prepareStatement in interface java.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:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareMessageProc

public CallableStatement prepareMessageProc(java.lang.String sql)
                                     throws SqlException
Throws:
SqlException

downgradeResultSetType

private int downgradeResultSetType(int resultSetType)

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
Specified by:
getTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException
Specified by:
setTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException

setHoldability

public void setHoldability(int holdability)
                    throws java.sql.SQLException
Specified by:
setHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException

getHoldability

public int getHoldability()
                   throws java.sql.SQLException
Specified by:
getHoldability in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint()
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepoint

public java.sql.Savepoint setSavepoint(java.lang.String name)
                                throws java.sql.SQLException
Specified by:
setSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

setSavepointX

private Savepoint setSavepointX(Savepoint savepoint)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

rollback

public void rollback(java.sql.Savepoint savepoint)
              throws java.sql.SQLException
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException

releaseSavepoint

public void releaseSavepoint(java.sql.Savepoint savepoint)
                      throws java.sql.SQLException
Specified by:
releaseSavepoint in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

createStatementX

private Statement createStatementX(int resultSetType,
                                   int resultSetConcurrency,
                                   int resultSetHoldability)
                            throws SqlException
Throws:
SqlException

resetStatement

protected void resetStatement(Statement s)
                       throws SqlException
Throws:
SqlException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency,
                                                   int resultSetHoldability)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatementX

PreparedStatement prepareStatementX(java.lang.String sql,
                                    int resultSetType,
                                    int resultSetConcurrency,
                                    int resultSetHoldability,
                                    int autoGeneratedKeys,
                                    java.lang.String[] columnNames,
                                    int[] columnIndexes)
                              throws SqlException
Throws:
SqlException

resetPrepareStatement

protected void resetPrepareStatement(PreparedStatement ps)
                              throws SqlException
Throws:
SqlException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency,
                                              int resultSetHoldability)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareCallX

CallableStatement prepareCallX(java.lang.String sql,
                               int resultSetType,
                               int resultSetConcurrency,
                               int resultSetHoldability)
                         throws SqlException
Throws:
SqlException

resetPrepareCall

protected void resetPrepareCall(CallableStatement cs)
                         throws SqlException
Throws:
SqlException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int autoGeneratedKeys)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int[] columnIndexes)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.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:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException

allowCloseInUOW_

protected abstract boolean allowCloseInUOW_()

doCloseStatementsOnClose_

protected abstract boolean doCloseStatementsOnClose_()

newSectionManager

public abstract SectionManager newSectionManager(java.lang.String collection,
                                                 Agent agent,
                                                 java.lang.String databaseName)

newAgent_

protected abstract Agent newAgent_(LogWriter logWriter,
                                   int loginTimeout,
                                   java.lang.String serverName,
                                   int portNumber,
                                   int clientSSLMode)
                            throws SqlException
Throws:
SqlException

newDatabaseMetaData_

protected abstract DatabaseMetaData newDatabaseMetaData_()

newStatement_

protected abstract Statement newStatement_(int type,
                                           int concurrency,
                                           int holdability)
                                    throws SqlException
Throws:
SqlException

resetStatement_

protected abstract void resetStatement_(Statement statement,
                                        int type,
                                        int concurrency,
                                        int holdability)
                                 throws SqlException
Throws:
SqlException

newPositionedUpdatePreparedStatement_

protected abstract PreparedStatement newPositionedUpdatePreparedStatement_(java.lang.String sql,
                                                                           Section section)
                                                                    throws SqlException
Throws:
SqlException

newPreparedStatement_

protected abstract PreparedStatement newPreparedStatement_(java.lang.String sql,
                                                           int type,
                                                           int concurrency,
                                                           int holdability,
                                                           int autoGeneratedKeys,
                                                           java.lang.String[] columnNames,
                                                           int[] columnIndexes)
                                                    throws SqlException
Throws:
SqlException

resetPreparedStatement_

protected abstract void resetPreparedStatement_(PreparedStatement ps,
                                                java.lang.String sql,
                                                int resultSetType,
                                                int resultSetConcurrency,
                                                int resultSetHoldability,
                                                int autoGeneratedKeys,
                                                java.lang.String[] columnNames,
                                                int[] columnIndexes)
                                         throws SqlException
Throws:
SqlException

newCallableStatement_

protected abstract CallableStatement newCallableStatement_(java.lang.String sql,
                                                           int type,
                                                           int concurrency,
                                                           int holdability)
                                                    throws SqlException
Throws:
SqlException

resetCallableStatement_

protected abstract void resetCallableStatement_(CallableStatement cs,
                                                java.lang.String sql,
                                                int resultSetType,
                                                int resultSetConcurrency,
                                                int resultSetHoldability)
                                         throws SqlException
Throws:
SqlException

completeConnect

public 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

writeXACommit_

protected abstract void writeXACommit_()
                                throws SqlException
Throws:
SqlException

readLocalXACommit_

public abstract void readLocalXACommit_()
                                 throws SqlException
Throws:
SqlException

readXACommit_

protected abstract void readXACommit_()
                               throws SqlException
Throws:
SqlException

writeLocalCommit_

public abstract void writeLocalCommit_()
                                throws SqlException
Throws:
SqlException

readLocalCommit_

public abstract void readLocalCommit_()
                               throws SqlException
Throws:
SqlException

writeXATransactionStart

protected abstract void writeXATransactionStart(Statement statement)
                                         throws SqlException
Throws:
SqlException

completeLocalCommit

public void completeLocalCommit()
Specified by:
completeLocalCommit in interface ConnectionCallbackInterface

writeLocalRollback_

public abstract void writeLocalRollback_()
                                  throws SqlException
Throws:
SqlException

readLocalRollback_

public abstract void readLocalRollback_()
                                 throws SqlException
Throws:
SqlException

completeLocalRollback

public void completeLocalRollback()
Specified by:
completeLocalRollback in interface ConnectionCallbackInterface

completeSpecificRollback

public void completeSpecificRollback(UnitOfWorkListener uwl)
Rollback the specific UnitOfWorkListener.

Parameters:
uwl - The UnitOfWorkLitener to be rolled back

writeLocalXARollback_

public abstract void writeLocalXARollback_()
                                    throws SqlException
Throws:
SqlException

writeXARollback_

protected abstract void writeXARollback_()
                                  throws SqlException
Throws:
SqlException

readLocalXARollback_

public abstract void readLocalXARollback_()
                                   throws SqlException
Throws:
SqlException

readXARollback_

protected abstract void readXARollback_()
                                 throws SqlException
Throws:
SqlException

writeTransactionStart

public void writeTransactionStart(Statement statement)
                           throws SqlException
Throws:
SqlException

readTransactionStart

public void readTransactionStart()
                          throws SqlException
Throws:
SqlException

completeTransactionStart

void completeTransactionStart()

completeAbnormalUnitOfWork

public void completeAbnormalUnitOfWork()
Specified by:
completeAbnormalUnitOfWork in interface ConnectionCallbackInterface

completeAbnormalUnitOfWork

public void completeAbnormalUnitOfWork(UnitOfWorkListener uwl)
Rollback the UnitOfWorkListener specifically.

Specified by:
completeAbnormalUnitOfWork in interface ConnectionCallbackInterface
Parameters:
uwl - The UnitOfWorkListener to be rolled back.

completeChainBreakingDisconnect

public void completeChainBreakingDisconnect()
Specified by:
completeChainBreakingDisconnect in interface ConnectionCallbackInterface

completeSqlca

public void completeSqlca(Sqlca sqlca)
Specified by:
completeSqlca in interface ConnectionCallbackInterface

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 interface ConnectionCallbackInterface
Parameters:
pbIsolation - new isolation level from the server

completePiggyBackSchema

public void completePiggyBackSchema(java.lang.String pbSchema)
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 interface ConnectionCallbackInterface
Parameters:
pbSchema - new current schema from the server

addSpecialRegisters

public abstract void addSpecialRegisters(java.lang.String s)

reset

public void reset(LogWriter logWriter)
           throws SqlException
Throws:
SqlException

lightReset

public void lightReset()
                throws SqlException
Throws:
SqlException

reset_

protected abstract void reset_(LogWriter logWriter)
                        throws SqlException
Throws:
SqlException

completeReset

protected void completeReset(boolean isDeferredReset,
                             boolean closeStatementsOnClose)
                      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. If true, it means statement pooling is disabled and the statements are fully reset, which includes a re-prepare. If false, 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

protected void checkForClosedConnection()
                                 throws SqlException
Throws:
SqlException

isXAConnection

public boolean isXAConnection()

getXAState

public int getXAState()

setXAState

public void setXAState(int state)

accumulateWarning

public void accumulateWarning(SqlWarning e)

accumulate440WarningForMessageProcFailure

public void accumulate440WarningForMessageProcFailure(SqlWarning e)

accumulate444WarningForMessageProcFailure

public void accumulate444WarningForMessageProcFailure(SqlWarning e)

getServerVersion

public int getServerVersion()

setInUnitOfWork

public void setInUnitOfWork(boolean inUnitOfWork)

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

public java.sql.Clob createClob()
                         throws java.sql.SQLException
Constructs an object that implements the Clob interface. The object returned initially contains no data.

Specified by:
createClob in interface java.sql.Connection
Returns:
An object that implements the Clob interface
Throws:
java.sql.SQLException - if an object that implements the Clob interface can not be constructed.

createBlob

public java.sql.Blob createBlob()
                         throws java.sql.SQLException
Constructs an object that implements the Blob interface. The object returned initially contains no data.

Specified by:
createBlob in interface java.sql.Connection
Returns:
An object that implements the Blob interface
Throws:
java.sql.SQLException - if an object that implements the Blob interface can not be constructed.

Built on Thu 2011-03-10 11:54:14+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.