|
|||||||||
| Home >> All >> org >> apache >> derby >> client >> [ am overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.client.am
Class Connection

java.lang.Objectorg.apache.derby.client.am.Connection
- All Implemented Interfaces:
- java.sql.Connection, ConnectionCallbackInterface
- public abstract class Connection
- extends java.lang.Object
- implements java.sql.Connection, ConnectionCallbackInterface
- extends java.lang.Object
| 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,
org.apache.derby.jdbc.ClientDataSource 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,
org.apache.derby.jdbc.ClientDataSource dataSource)
|
protected |
Connection(LogWriter logWriter,
java.lang.String user,
java.lang.String password,
org.apache.derby.jdbc.ClientDataSource 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_()
|
(package private) void |
checkAutoGeneratedKeysParameters(int autoGeneratedKeys,
java.lang.String[] columnNames)
|
protected void |
checkForClosedConnection()
|
private void |
checkForInvalidXAStateOnCommitOrRollback()
|
(package private) void |
checkForTransactionInProgress()
|
void |
clearWarnings()
This method clears all warnings that have occurred on this connection. |
void |
clearWarningsX()
|
void |
close()
This method immediately closes this database connection. |
void |
closeForReuse()
|
void |
closeResources()
|
private void |
closeResourcesX()
|
void |
closeX()
|
void |
commit()
This method commits any SQL statements executed on this connection since the last commit or rollback. |
void |
completeAbnormalUnitOfWork()
|
void |
completeChainBreakingDisconnect()
|
void |
completeConnect()
|
void |
completeLocalCommit()
|
void |
completeLocalRollback()
|
protected void |
completeReset(boolean isDeferredReset,
boolean recomputeFromDataSource)
|
void |
completeSqlca(Sqlca sqlca)
|
(package private) void |
completeTransactionStart()
|
java.sql.Statement |
createStatement()
This method creates a new SQL statement. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
This method creates a new SQL statement with the specified type and concurrency. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new SQL statement with the specified type, concurrency and holdability, instead of using the defaults. |
private Statement |
createStatementX(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
protected abstract boolean |
doCloseStatementsOnClose_()
|
private int |
downgradeResultSetConcurrency(int resultSetConcurrency,
int resultSetType)
|
private int |
downgradeResultSetType(int resultSetType)
|
protected void |
finalize()
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. |
void |
flowAutoCommit()
|
private void |
flowClose()
|
void |
flowCommit()
|
protected void |
flowRollback()
|
boolean |
getAutoCommit()
This method tests whether or not auto commit mode is currently enabled. |
java.lang.String |
getCatalog()
This method returns the name of the catalog in use by this connection, if any. |
int |
getHoldability()
Gets the default holdability of ResultSetS that are created
from StatementS using this Connection. |
java.sql.DatabaseMetaData |
getMetaData()
This method returns the meta data for this database connection. |
int |
getServerVersion()
|
int |
getTransactionIsolation()
This method returns the current transaction isolation mode. |
java.util.Map |
getTypeMap()
This method returns the mapping of SQL types to Java classes currently in use by this connection. |
java.sql.SQLWarning |
getWarnings()
This method returns the first warning that occurred on this connection, if any. |
int |
getXAState()
|
protected void |
initConnection(LogWriter logWriter,
java.lang.String user,
org.apache.derby.jdbc.ClientDataSource dataSource)
|
boolean |
isClosed()
This method tests whether or not this connection has been closed. |
boolean |
isClosedX()
|
protected abstract boolean |
isGlobalPending_()
|
boolean |
isPhysicalConnClosed()
Return true if the physical connection is still open. |
boolean |
isReadOnly()
This method tests whether or not this connection is in read only mode. |
boolean |
isXAConnection()
|
void |
lightReset()
|
protected abstract void |
markClosed_()
|
void |
markClosed()
|
private void |
markClosedForReuse()
|
private void |
markStatementsClosed()
|
java.lang.String |
nativeSQL(java.lang.String sql)
This method converts the specified generic SQL statement into the native grammer of the database this object is connected to. |
java.lang.String |
nativeSQLX(java.lang.String sql)
|
protected abstract Agent |
newAgent_(LogWriter logWriter,
int loginTimeout,
java.lang.String serverName,
int portNumber)
|
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)
|
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)
This method creates a new CallableStatement for the
specified SQL string. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
This method creates a new CallableStatement for the
specified SQL string. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new CallableStatement for the
specified SQL string. |
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)
This method creates a new PreparedStatement for the specified
SQL string. |
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)
This method creates a new PreparedStatement for the specified
SQL string. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
This method creates a new PreparedStatement for the specified
SQL string. |
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)
|
(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()
|
void |
releaseSavepoint(java.sql.Savepoint savepoint)
Removes the specified savepoint from this Connection. |
protected abstract void |
reset_(LogWriter logWriter,
org.apache.derby.jdbc.ClientDataSource ds,
boolean recomputerFromDataSource)
|
protected abstract void |
reset_(LogWriter logWriter,
java.lang.String user,
java.lang.String password,
org.apache.derby.jdbc.ClientDataSource ds,
boolean recomputerFromDataSource)
|
void |
reset(LogWriter logWriter,
org.apache.derby.jdbc.ClientDataSource ds,
boolean recomputeFromDataSource)
|
void |
reset(LogWriter logWriter,
java.lang.String user,
java.lang.String password,
org.apache.derby.jdbc.ClientDataSource ds,
boolean recomputeFromDataSource)
|
protected abstract void |
resetCallableStatement_(CallableStatement cs,
java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
|
protected void |
resetConnection(LogWriter logWriter,
java.lang.String user,
org.apache.derby.jdbc.ClientDataSource ds,
boolean recomputeFromDataSource)
|
protected void |
resetConnection(LogWriter logWriter,
java.lang.String databaseName,
java.util.Properties properties)
|
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)
|
protected void |
resetPrepareStatement(PreparedStatement ps)
|
protected abstract void |
resetStatement_(Statement statement,
int type,
int concurrency,
int holdability)
|
protected void |
resetStatement(Statement s)
|
void |
rollback()
This method rolls back any SQL statements executed on this connection since the last commit or rollback. |
void |
rollback(java.sql.Savepoint savepoint)
Undoes all changes made after the specified savepoint was set. |
void |
setAutoCommit(boolean autoCommit)
This method turns auto commit mode on or off. |
void |
setCatalog(java.lang.String catalog)
This method sets the name of the catalog in use by this connection. |
void |
setHoldability(int holdability)
Sets the default holdability of ResultSetS that are created
from StatementS using this Connection. |
void |
setInUnitOfWork(boolean inUnitOfWork)
|
void |
setReadOnly(boolean readOnly)
This method turns read only mode on or off. |
java.sql.Savepoint |
setSavepoint()
Creates a new unnamed savepoint for this Connection |
java.sql.Savepoint |
setSavepoint(java.lang.String name)
Creates a new savepoint with the specifiend name for this Connection. |
private Savepoint |
setSavepointX(Savepoint savepoint)
|
void |
setTransactionIsolation(int level)
This method sets the current transaction isolation mode. |
void |
setTypeMap(java.util.Map map)
This method sets the mapping table for SQL types to Java classes. |
void |
setXAState(int state)
|
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)
|
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
agent_
public Agent agent_
databaseMetaData_
public DatabaseMetaData databaseMetaData_
openStatements_
final java.util.LinkedList openStatements_
RollbackOnlyListeners_
final java.util.LinkedList RollbackOnlyListeners_
CommitAndRollbackListeners_
final java.util.LinkedList CommitAndRollbackListeners_
warnings_
private SqlWarning warnings_
user_
public transient java.lang.String user_
retrieveMessageText_
public boolean retrieveMessageText_
jdbcReadOnly_
protected boolean jdbcReadOnly_
resultSetHoldability_
public int resultSetHoldability_
databaseName_
public java.lang.String databaseName_
productID_
public java.lang.String productID_
encryptionManager_
protected EncryptionManager encryptionManager_
setTransactionIsolationStmt
private Statement setTransactionIsolationStmt
open_
protected boolean open_
availableForReuse_
protected boolean availableForReuse_
isolation_
public int isolation_
autoCommit_
public boolean autoCommit_
inUnitOfWork_
protected boolean inUnitOfWork_
accumulated440ForMessageProcFailure_
private boolean accumulated440ForMessageProcFailure_
accumulated444ForMessageProcFailure_
private boolean accumulated444ForMessageProcFailure_
accumulatedSetReadOnlyWarning_
private boolean accumulatedSetReadOnlyWarning_
isXAConnection_
protected boolean isXAConnection_
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
xaState_
protected int xaState_
xaHostVersion_
public int xaHostVersion_
loginTimeout_
public int loginTimeout_
dataSource_
public org.apache.derby.jdbc.ClientDataSource dataSource_
serverNameIP_
public java.lang.String serverNameIP_
portNumber_
public int portNumber_
clientCursorNameCache_
public java.util.Hashtable clientCursorNameCache_
canUseCachedConnectBytes_
public boolean canUseCachedConnectBytes_
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
| Constructor Detail |
Connection
protected Connection(LogWriter logWriter, java.lang.String user, java.lang.String password, org.apache.derby.jdbc.ClientDataSource dataSource) throws SqlException
Connection
protected Connection(LogWriter logWriter, java.lang.String user, java.lang.String password, boolean isXAConn, org.apache.derby.jdbc.ClientDataSource dataSource) throws SqlException
Connection
protected Connection(LogWriter logWriter, boolean isXAConn, org.apache.derby.jdbc.ClientDataSource dataSource) 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
| Method Detail |
initConnection
protected void initConnection(LogWriter logWriter, java.lang.String user, org.apache.derby.jdbc.ClientDataSource dataSource) throws SqlException
resetConnection
protected void resetConnection(LogWriter logWriter, java.lang.String user, org.apache.derby.jdbc.ClientDataSource ds, boolean recomputeFromDataSource) throws SqlException
resetConnection
protected void resetConnection(LogWriter logWriter, java.lang.String databaseName, java.util.Properties properties) throws SqlException
finalize
protected void finalize()
throws java.lang.Throwable
- Description copied from class:
java.lang.Object - Called on an object by the Virtual Machine at most once,
at some point after the Object is determined unreachable
but before it is destroyed. You would think that this
means it eventually is called on every Object, but this is
not necessarily the case. If execution terminates
abnormally, garbage collection does not always happen.
Thus you cannot rely on this method to always work.
For finer control over garbage collection, use references
from the
java.lang.refpackage.Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply
super.finalize().finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.
If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.
It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.
Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls
super.finalize().The default implementation does nothing.
createStatement
public java.sql.Statement createStatement() throws SqlException
- Description copied from interface:
java.sql.Connection - This method creates a new SQL statement. The default result set type
and concurrency will be used.
- Specified by:
createStatementin interfacejava.sql.Connection
prepareStatement
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws SqlException
- Description copied from interface:
java.sql.Connection - This method creates a new
PreparedStatementfor the specified SQL string. This method is designed for use with parameterized statements. The default result set type and concurrency will be used.- Specified by:
prepareStatementin interfacejava.sql.Connection
preparePositionedUpdateStatement
public PreparedStatement preparePositionedUpdateStatement(java.lang.String sql, Section querySection) throws SqlException
prepareCall
public java.sql.CallableStatement prepareCall(java.lang.String sql) throws SqlException
- Description copied from interface:
java.sql.Connection - This method creates a new
CallableStatementfor the specified SQL string. Thie method is designed to be used with stored procedures. The default result set type and concurrency will be used.- Specified by:
prepareCallin interfacejava.sql.Connection
prepareDynamicCatalogQuery
PreparedStatement prepareDynamicCatalogQuery(java.lang.String sql) throws SqlException
nativeSQL
public java.lang.String nativeSQL(java.lang.String sql) throws SqlException
- Description copied from interface:
java.sql.Connection - This method converts the specified generic SQL statement into the
native grammer of the database this object is connected to.
- Specified by:
nativeSQLin interfacejava.sql.Connection
nativeSQLX
public java.lang.String nativeSQLX(java.lang.String sql) throws SqlException
allowLocalCommitRollback_
protected abstract boolean allowLocalCommitRollback_()
throws SqlException
setAutoCommit
public void setAutoCommit(boolean autoCommit)
throws SqlException
- Description copied from interface:
java.sql.Connection - This method turns auto commit mode on or off. In auto commit mode,
every SQL statement is committed its own transaction. Otherwise a
transaction must be explicitly committed or rolled back.
- Specified by:
setAutoCommitin interfacejava.sql.Connection
getAutoCommit
public boolean getAutoCommit()
throws SqlException
- Description copied from interface:
java.sql.Connection - This method tests whether or not auto commit mode is currently enabled.
In auto commit mode, every SQL statement is committed its own transaction.
Otherwise a transaction must be explicitly committed or rolled back.
- Specified by:
getAutoCommitin interfacejava.sql.Connection
commit
public void commit()
throws SqlException
- Description copied from interface:
java.sql.Connection - This method commits any SQL statements executed on this connection since
the last commit or rollback.
- Specified by:
commitin interfacejava.sql.Connection
checkForInvalidXAStateOnCommitOrRollback
private void checkForInvalidXAStateOnCommitOrRollback()
throws SqlException
flowCommit
public void flowCommit()
throws SqlException
flowAutoCommit
public void flowAutoCommit()
throws SqlException
willAutoCommitGenerateFlow
public boolean willAutoCommitGenerateFlow()
throws SqlException
writeAutoCommit
void writeAutoCommit()
throws SqlException
writeCommit
public void writeCommit()
throws SqlException
readAutoCommit
void readAutoCommit()
throws SqlException
readCommit
public void readCommit()
throws SqlException
rollback
public void rollback()
throws SqlException
- Description copied from interface:
java.sql.Connection - This method rolls back any SQL statements executed on this connection
since the last commit or rollback.
- Specified by:
rollbackin interfacejava.sql.Connection
flowRollback
protected void flowRollback()
throws SqlException
writeRollback
public void writeRollback()
throws SqlException
readRollback
public void readRollback()
throws SqlException
close
public void close()
throws SqlException
- Description copied from interface:
java.sql.Connection - This method immediately closes this database connection.
- Specified by:
closein interfacejava.sql.Connection
checkForTransactionInProgress
void checkForTransactionInProgress()
throws SqlException
closeX
public void closeX()
throws SqlException
closeResources
public void closeResources()
throws SqlException
closeResourcesX
private void closeResourcesX()
throws SqlException
isGlobalPending_
protected abstract boolean isGlobalPending_()
closeForReuse
public void closeForReuse()
throws SqlException
flowClose
private void flowClose()
throws SqlException
markClosed_
protected abstract void markClosed_()
markClosed
public void markClosed()
markClosedForReuse
private void markClosedForReuse()
markStatementsClosed
private void markStatementsClosed()
writeCloseStatements
private void writeCloseStatements()
throws SqlException
readCloseStatements
private void readCloseStatements()
throws SqlException
isPhysicalConnClosed
public boolean isPhysicalConnClosed()
- Return true if the physical connection is still open.
Might be logically closed but available for reuse.
isClosed
public boolean isClosed()
- Description copied from interface:
java.sql.Connection - This method tests whether or not this connection has been closed.
- Specified by:
isClosedin interfacejava.sql.Connection
isClosedX
public boolean isClosedX()
setTransactionIsolation
public void setTransactionIsolation(int level)
throws SqlException
- Description copied from interface:
java.sql.Connection - This method sets the current transaction isolation mode. This must
be one of the constants defined in this interface.
- Specified by:
setTransactionIsolationin interfacejava.sql.Connection
getTransactionIsolation
public int getTransactionIsolation()
throws SqlException
- Description copied from interface:
java.sql.Connection - This method returns the current transaction isolation mode. This will
be one of the constants defined in this interface.
- Specified by:
getTransactionIsolationin interfacejava.sql.Connection
getWarnings
public java.sql.SQLWarning getWarnings()
- Description copied from interface:
java.sql.Connection - This method returns the first warning that occurred on this connection,
if any. If there were any subsequence warnings, they will be chained
to the first one.
- Specified by:
g
JAVADOC
org.apache.derby.client.am.Connection