Top Fields Constructors Methods
org.apache.derby.client.am

public abstract Class ClientConnection

extends Object
implements Connection, ConnectionCallbackInterface
Class Inheritance
All Implemented Interfaces
org.apache.derby.client.am.ConnectionCallbackInterface, java.sql.Connection, java.lang.AutoCloseable, java.sql.Wrapper
Known Direct Subclasses
org.apache.derby.client.net.NetConnection
Imports
java.sql.Blob, .CallableStatement, .Clob, .Connection, .DatabaseMetaData, .PreparedStatement, .ResultSet, .SQLException, .SQLPermission, .SQLWarning, .Savepoint, .Statement, java.util.Collections, .HashMap, .Hashtable, .Iterator, .Map, .Properties, .Set, .WeakHashMap, java.util.concurrent.Executor, org.apache.derby.client.net.NetXAResource, org.apache.derby.client.BasicClientDataSource, .ClientDataSourceInterface, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
public Agent
public boolean
private boolean
pack-priv Hashtable<String, String>
private int
public int
pack-priv final WeakHashMap<UnitOfWorkListener, Void>
private String
currentSchemaName_

Cached copy of the schema name.

public ClientDatabaseMetaData
public String
public BasicClientDataSource
private int
defaultIsolation

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
holdability

Holdabilty for created statements.

protected boolean
private static final int
private int
isolation_

Cached copy of the isolation level.

private final HashMap<String, ClientPreparedStatement>
protected boolean
private boolean
private CallableLocatorProcedures
lobProcs

Reference to object with prepared statements for calling the locator procedures.

private int
protected boolean
pack-priv final WeakHashMap<ClientStatement, Void>
public int
public String
public boolean
pack-priv boolean
public String
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).

private int
protected final String
private SqlWarning
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.

public static final int
XA_T1_ASSOCIATED

XA_T1_ASSOCIATED In this state commits will not flow in autocommit mode.

public int
private int

Constructor Summary

AccessConstructor and Description
protected
ClientConnection(LogWriter logWriter, String user, String password, BasicClientDataSource dataSource)

protected
ClientConnection(LogWriter logWriter, String user, String password, boolean isXAConn, BasicClientDataSource dataSource)

protected
ClientConnection(LogWriter logWriter, boolean isXAConn, BasicClientDataSource dataSource)

protected
ClientConnection(LogWriter logWriter, int driverManagerLoginTimeout, String serverName, int portNumber, String databaseName, Properties properties)

Method Summary

Modifier and TypeMethod and Description
public void
abort(Executor
The Executor implementation which will be used by abort.
executor
)

Implements java.sql.Connection.abort.

Terminates an open connection.
pack-priv void
pack-priv void
private void
protected abstract boolean
protected abstract boolean
protected void
beginAborting()

Begin aborting the connection

protected void
private void
pack-priv void
checkForTransactionInProgress()

Check if the transaction is in progress and the connection cannot be closed.

public synchronized void
clearWarnings()

Implements java.sql.Connection.clearWarnings.

Clears all warnings reported for this Connection object.
private void
public synchronized void
close()

Implements java.sql.Connection.close.

Releases this Connection object's database and JDBC resources immediately instead of waiting for them to be automatically released.
pack-priv synchronized void
closeForReuse(boolean statementPooling)

public synchronized void
private void
private void
public synchronized void
commit()

Implements java.sql.Connection.commit.

Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this Connection object.
public void
public void
completeAbnormalUnitOfWork(UnitOfWorkListener
The UnitOfWorkListener to be rolled back.
uwl
)

Implements org.apache.derby.client.am.ConnectionCallbackInterface.completeAbnormalUnitOfWork.

Rollback the UnitOfWorkListener specifically.
public void
public final void
public void
completeInitialPiggyBackIsolation(int
isolation level as specified by java.sql.Connection
pbIsolation
)

Sets the default isolation level of the connection upon connection initialization.

public void
completeInitialPiggyBackSchema(String
the schema name
pbSchema
)

Sets the current schema upon connection initialization.

public void
public void
public void
completePiggyBackIsolation(int
new isolation level from the server
pbIsolation
)

Implements org.apache.derby.client.am.ConnectionCallbackInterface.completePiggyBackIsolation.

Completes piggy-backing of the new current isolation level by updating the cached copy in am.Connection.
public void
completePiggyBackSchema(String
new current schema from the server
pbSchema
)

Implements org.apache.derby.client.am.ConnectionCallbackInterface.completePiggyBackSchema.

Completes piggy-backing of the new current schema by updating the cached copy in am.Connection.
protected void
completeReset(boolean
True if this is for a deferred reset
isDeferredReset
,
boolean
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.
closeStatementsOnClose
,
NetXAResource
XA resource
xares
)

We don't reset the isolation level to unknown unconditionally, as this forces us to go to the server all the time.

private void
completeSpecificRollback(UnitOfWorkListener
The UnitOfWorkLitener to be rolled back
uwl
)

Rollback the specific UnitOfWorkListener.

public void
pack-priv void
public Blob

Returns:

An object that implements the Blob interface
createBlob
()

Implements java.sql.Connection.createBlob.

Constructs an object that implements the Blob interface.
public Clob

Returns:

An object that implements the Clob interface
createClob
()

Implements java.sql.Connection.createClob.

Constructs an object that implements the Clob interface.
public synchronized Statement
createStatement()

Implements java.sql.Connection.createStatement.

Creates a Statement object for sending SQL statements to the database.
public synchronized Statement
createStatement(int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Implements java.sql.Connection.createStatement.

Creates a Statement object that will generate ResultSet objects with the given type and concurrency.
public synchronized Statement
createStatement(int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Implements java.sql.Connection.createStatement.

Creates a Statement object that will generate ResultSet objects with the given type, concurrency, and holdability.
private ClientStatement
createStatementX(int resultSetType, int resultSetConcurrency, int resultSetHoldability)

protected abstract boolean
private int
downgradeResultSetType(int resultSetType)

protected void
finalize()

Overrides java.lang.Object.finalize.

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
public boolean
private void
private void
protected void
public boolean
getAutoCommit()

Implements java.sql.Connection.getAutoCommit.

Retrieves the current auto-commit mode for this Connection object.
public String
getCatalog()

Implements java.sql.Connection.getCatalog.

Retrieves this Connection object's current catalog name.
public String

Returns:

the name of the current schema
getCurrentSchemaName
()

Returns the current schema (the schema that would be used for compilation.

public int
getHoldability()

Implements java.sql.Connection.getHoldability.

Retrieves the current holdability of ResultSet objects created using this Connection object.
public DatabaseMetaData
getMetaData()

Implements java.sql.Connection.getMetaData.

Retrieves a DatabaseMetaData object that contains metadata about the database to which this Connection object represents a connection.
public int
getNetworkTimeout()

Implements java.sql.Connection.getNetworkTimeout.

Retrieves the number of milliseconds the driver will wait for a database request to complete.
public String
getSchema()

Implements java.sql.Connection.getSchema.

Get the name of the current schema.
public int
public int

Returns:

the ID of the active transaction
getTransactionID
()

Returns the ID of the active transaction for this connection.

public int
getTransactionIsolation()

Implements java.sql.Connection.getTransactionIsolation.

Retrieves this Connection object's current transaction isolation level.
public int
public Map<String, Class<?>>
getTypeMap()

Implements java.sql.Connection.getTypeMap.

Retrieves the Map object associated with this Connection object.
public SQLWarning
getWarnings()

Implements java.sql.Connection.getWarnings.

Retrieves the first warning reported by calls on this Connection object.
public int
pack-priv final int
holdability()

Return the holdabilty for the Connection.

private void
public boolean

Returns:

true if we are in the middle of aborting
isAborting
()

Return true if the connection is aborting

public boolean
isClosed()

Implements java.sql.Connection.isClosed.

Retrieves whether this Connection object has been closed.
public boolean
protected abstract boolean
public boolean

Returns:

true if physical connection still open
isPhysicalConnClosed
()

Return true if the physical connection is still open.

public boolean
isReadOnly()

Implements java.sql.Connection.isReadOnly.

Retrieves whether this Connection object is in read-only mode.
public boolean
public synchronized void
pack-priv CallableLocatorProcedures

Returns:

object with prepared statements for calling locator procedures
locatorProcedureCall
()

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
public String
nativeSQL(String
an SQL statement that may contain one or more '?' parameter placeholders
sql
)

Implements java.sql.Connection.nativeSQL.

Converts the given SQL statement into the system's native SQL grammar.
pack-priv synchronized String
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
protected abstract ClientPreparedStatement
newPreparedStatement_(String sql, int type, int concurrency, int holdability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes)

public abstract SectionManager
protected abstract ClientStatement
newStatement_(int type, int concurrency, int holdability)

public synchronized CallableStatement
prepareCall(String
an SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is specified using JDBC call escape syntax.
sql
)

Implements java.sql.Connection.prepareCall.

Creates a CallableStatement object for calling database stored procedures.
public synchronized CallableStatement
prepareCall(String
a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
sql
,
int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Implements java.sql.Connection.prepareCall.

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
public synchronized CallableStatement
prepareCall(String
a String object that is the SQL statement to be sent to the database; may contain on or more '?' parameters
sql
,
int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Implements java.sql.Connection.prepareCall.

Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency.
pack-priv ClientCallableStatement
prepareCallX(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)

pack-priv synchronized ClientPreparedStatement
pack-priv synchronized ClientCallableStatement
pack-priv synchronized ClientPreparedStatement
public synchronized PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
)

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object for sending parameterized SQL statements to the database.
public synchronized PreparedStatement
prepareStatement(String
a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
sql
,
int
a result set type; one of ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
a concurrency type; one of ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
)

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type and concurrency.
public synchronized PreparedStatement
prepareStatement(String
a String object that is the SQL statement to be sent to the database; may contain one or more '?' IN parameters
sql
,
int
one of the following ResultSet constants: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE, or ResultSet.TYPE_SCROLL_SENSITIVE
resultSetType
,
int
one of the following ResultSet constants: ResultSet.CONCUR_READ_ONLY or ResultSet.CONCUR_UPDATABLE
resultSetConcurrency
,
int
one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
resultSetHoldability
)

Implements java.sql.Connection.prepareStatement.

Creates a PreparedStatement object that will generate ResultSet objects with the given type, concurrency, and holdability.
public PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
int
a flag indicating whether auto-generated keys should be returned; one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
autoGeneratedKeys
)

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object that has the capability to retrieve auto-generated keys.
public PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
int[]
an array of column indexes indicating the columns that should be returned from the inserted row or rows
columnIndexes
)

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
public PreparedStatement
prepareStatement(String
an SQL statement that may contain one or more '?' IN parameter placeholders
sql
,
String[]
an array of column names indicating the columns that should be returned from the inserted row or rows
columnNames
)

Implements java.sql.Connection.prepareStatement.

Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.
pack-priv ClientPreparedStatement
prepareStatementX(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, String[] columnNames, int[] columnIndexes)

pack-priv void
private void
pack-priv void
public abstract void
public abstract void
public abstract void
public abstract void
public abstract void
public abstract void
private void
public void
protected abstract void
protected abstract void
public synchronized void
releaseSavepoint(Savepoint
the Savepoint object to be removed
savepoint
)

Implements java.sql.Connection.releaseSavepoint.

Removes the specified Savepoint and subsequent Savepoint objects from the current transaction.
public synchronized void
reset(LogWriter logWriter)

protected abstract void
reset_(LogWriter logWriter)

protected abstract void
resetCallableStatement_(ClientCallableStatement cs, String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)

protected void
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)

public synchronized void
rollback()

Implements java.sql.Connection.rollback.

Undoes all changes made in the current transaction and releases any database locks currently held by this Connection object.
public synchronized void
rollback(Savepoint
the Savepoint object to roll back to
savepoint
)

Implements java.sql.Connection.rollback.

Undoes all changes made after the given Savepoint object was set.
protected abstract boolean

Returns:

true if LOB locators are supported.
serverSupportsLocators
()

Checks whether the server supports locators for large objects.

protected abstract boolean

Returns:

whether the server supports nanoseconds in timestamps
serverSupportsTimestampNanoseconds
()

Return true if the server supports nanoseconds in timestamps

public synchronized void
setAutoCommit(boolean
true to enable auto-commit mode; false to disable it
autoCommit
)

Implements java.sql.Connection.setAutoCommit.

Sets this connection's auto-commit mode to the given state.
public synchronized void
setCatalog(String
the name of a catalog (subspace in this Connection object's database) in which to work
catalog
)

Implements java.sql.Connection.setCatalog.

Sets the given catalog name in order to select a subspace of this Connection object's database in which to work.
public synchronized void
setHoldability(int
a ResultSet holdability constant; one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
holdability
)

Implements java.sql.Connection.setHoldability.

Changes the default holdability of ResultSet objects created using this Connection object to the given holdability.
public void
setNetworkTimeout(Executor
The Executor implementation which will be used by setNetworkTimeout.
executor
,
int
The time in milliseconds to wait for the database operation to complete. If the JDBC driver does not support milliseconds, the JDBC driver will round the value up to the nearest second. If the timeout period expires before the operation completes, a SQLException will be thrown. A value of 0 indicates that there is not timeout for database operations.
milliseconds
)

Implements java.sql.Connection.setNetworkTimeout.

Sets the maximum period a Connection or objects created from the Connection will wait for the database to reply to any one request.
public synchronized void
setReadOnly(boolean
true enables read-only mode; false disables it
readOnly
)

Implements java.sql.Connection.setReadOnly.

Puts this connection in read-only mode as a hint to the driver to enable database optimizations.
public synchronized Savepoint
setSavepoint()

Implements java.sql.Connection.setSavepoint.

Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.
public synchronized Savepoint
setSavepoint(String
a String containing the name of the savepoint
name
)

Implements java.sql.Connection.setSavepoint.

Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.
private ClientSavepoint
public void
setSchema(String
the name of a schema in which to work
schemaName
)

Implements java.sql.Connection.setSchema.

Set the default schema for the Connection.
public synchronized void
setTransactionIsolation(int
one of the following Connection constants: Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED, Connection.TRANSACTION_REPEATABLE_READ, or Connection.TRANSACTION_SERIALIZABLE. (Note that Connection.TRANSACTION_NONE cannot be used because it specifies that transactions are not supported.)
level
)

Implements java.sql.Connection.setTransactionIsolation.

Attempts to change the transaction isolation level for this Connection object to the one given.
private void
setTransactionIsolationX(int level)

Set the transaction isolation level as specified.

public synchronized void
setTypeMap(Map<K, V>
the java.util.Map object to install as the replacement for this Connection object's default type map
map
)

Implements java.sql.Connection.setTypeMap.

Installs the given TypeMap object as the type map for this Connection object.
public void
setXAState(int state)

protected abstract boolean

Returns:

true if sessionData is supported
supportsSessionDataCaching
()

Finds out if the underlaying database connection supports session data caching.

public boolean

Returns:

true if the connection cannot be closed due to uncommitted operations in the transaction
transactionInProgress
()

Check if there are uncommitted operations in the current transaction that prevent us from closing the connection.

private int

Returns:

isolation level as a JDBC integer value
translateIsolation
(String
SQL isolation string
isolationStr
)

Translates the isolation level from a SQL string to the JDBC int value

public boolean
pack-priv void
private void
pack-priv void
public abstract void
public abstract void
public abstract void
public abstract void
public abstract void
public abstract void
private void
public void
protected abstract void
protected abstract void
protected abstract void
Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait