There is always a single root (parent) connection. The initial JDBC connection is the root connection. A call to getCurrentConnection() or with the URL jdbc:default:connection yields a nested connection that shares the same root connection as the parent. A nested connection is implemented using this class. The nested connection copies the state of the parent connection and shares some of the same objects (e.g. ContextManager) that are shared across all nesting levels. The proxy also maintains its own state that is distinct from its parent connection (e.g. autocommit or warnings).
Synchronization
Just about all JDBC actions are synchronized across all connections stemming from the same root connection. The synchronization is upon the a synchronized object return by the rootConnection.
Supports
TransactionResourceImpl
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private boolean | |
| private Connection | applicationConnection
The Connection object the application is using when accessing the database through this connection. |
| pack-priv boolean | |
| private int | |
| private String | connString
Cached string representation of the connection id |
| pack-priv DatabaseMetaData | |
| protected static final StandardException | |
| private InternalDriver | factory
Factory for JDBC objects to be created. |
| private HashSet | |
| private HashMap | |
| private int | |
| private WeakHashMap | lobReferences
Map to keep track of all the lobs associated with this connection. |
| public static final LowMemory | memoryState
Low memory state object for connection requests. |
| pack-priv boolean | |
| public static final SQLException | NO_MEM
Static exception to be thrown when a Connection request can not be fulfilled due to lack of memory. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private int | resultSetId
An increasing counter to assign to a ResultSet on its creation. |
| pack-priv final EmbedConnection | |
| private SQLWarning | |
| pack-priv TransactionResourceImpl | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | EmbedConnection(EmbedConnection
the input connection inputConnection)Create a new connection based off of the connection passed in. Initializes state based on input connection, and copies appropriate object pointers. |
| Modifier and Type | Method and Description |
|---|---|
| public void | abort(Executor
The executor)Executor implementation which will
be used by abort.Implements org. Terminates an open connection. |
| pack-priv void | |
| public int | Returns: an integer that represents the locator that has been allocated to this LOB.The object which contains the LOB object that
that is added to the HashMap. LOBReference)Add the locator and the corresponding LOB object into the HashMap |
| pack-priv void | |
| public final synchronized void | addWarning(SQLWarning
Warning to be added, will be chained to any
existing warnings. newWarning)Implements org. Add a warning to the current list of warnings, to follow this note from Connection.getWarnings. |
| protected void | |
| private boolean | Returns: false iff the monitor cannot handle a service of the type indicated by the protocol within the name. If that's the case then we are the wrong driver.boot properties info, boolean If true, don't fail soft upgrade due
to missing features (phase one of two phased hard upgrade boot). softAuthenticationBoot)Boot database. |
| public void | |
| private void | checkConflictingCryptoAttributes(Properties
boot properties (for instance URL connection attributes) p)Examines the boot properties looking for conflicting cryptographic options and commands. |
| private void | checkDatabaseBooted(Database
The database that should have been booted database, String The operation that requires that the database has
already been booted, used in the exception message if not booted operation, String The name of the database that should have been booted,
used in the exception message if not booted dbname)Check that a database has already been booted. |
| private void | checkDatabaseCreatePrivileges(String
The user to be checked for database create privileges user, String the name of the database to create dbname)Checks that a user has the system privileges to create a database. |
| public void | checkForTransactionInProgress()
Check if the transaction is active so that we cannot close down the connection. |
| protected final void | |
| private void | checkIsDBOwner(int
attempted operation which needs database owner powers operation)Check if actual authenticationId is equal to the database owner's. |
| private void | |
| private void | checkUserIsNotARole()
If applicable, check that we don't connect with a user name that equals a role. |
| private void | |
| public final synchronized void | clearWarnings()
Implements java. After this call, getWarnings returns null until a new warning is reported for this Connection. |
| public void | close()
Implements java. In some cases, it is desirable to immediately release a Connection's database and JDBC resources instead of waiting for them to be automatically released; the close method provides this immediate release. |
| protected void | |
| public void | commit()
Implements java. Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. |
| protected void | |
| protected void | |
| private Savepoint | Returns: The new Savepoint objectA String containing the name of the savepoint. Will
be null if this is an unnamed savepoint name, boolean If true means it's a named
user defined savepoint. userSuppliedSavepointName)Creates a savepoint with the given name (if it is a named savepoint else we will generate a name because Derby only supports named savepoints internally) in the current transaction and returns the new Savepoint object that represents it. |
| private boolean | compareDatabaseNames(String leftDBName, String rightDBName)
Compare two user-specified database names to see if they identify the same database. |
| public Array | createArrayOf(String
the SQL name of the type the elements of the array map to. The typeName is a
database-specific name which may be the name of a built-in type, a user-defined type or a standard SQL type supported by this database. This
is the value returned by typeName, Object[] Array.getBaseTypeNamethe elements that populate the returned object elements)Implements java. Factory method for creating Array objects. |
| public Blob | Returns: An object that implements theBlob interfaceImplements java. Constructs an object that implements the |
| private boolean | Returns: true iff the attribute create=true is provided. This means create a standard database. In other cases, returns false.the attribute set. p)Examine the attributes set provided for illegal boot combinations and determine if this is a create boot. |
| public Clob | Returns: An object that implements theClob interfaceImplements java. Constructs an object that implements the |
| private Database | Returns: Database The newly created database or null.the database name dbname, Properties the properties info)Create a new database. |
| public NClob | createNClob()
Implements java. Constructs an object that implements the |
| private static Object | createPersistentService(final String factoryInterface, final String serviceName, final Properties properties)
Must be private so that user code can't call this entry point. |
| public SQLXML | createSQLXML()
Implements java. Constructs an object that implements the |
| public final Statement | Returns: a new Statement objectImplements java. SQL statements without parameters are normally executed using Statement objects. |
| public final Statement | Returns: a new Statement objecta result set type, see ResultSet.TYPE_XXX resultSetType, int a concurrency type, see ResultSet.CONCUR_XXX resultSetConcurrency)Implements java. JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden. |
| public final Statement | Returns: a new Statement objecta result set type, see ResultSet.TYPE_XXX resultSetType, int a concurrency type, see ResultSet.CONCUR_XXX resultSetConcurrency, int a holdability type,
ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT resultSetHoldability)Implements java. JDBC 3.0 Same as createStatement() above, but allows the default result set type, result set concurrency type and result set holdability type to be overridden. |
| public Struct | createStruct(String
the SQL type name of the SQL structured type that this typeName, Object[] Struct
object maps to. The typeName is the name of a user-defined type that
has been defined for this database. It is the value returned by
Struct.getSQLTypeName.the attributes that populate the returned object attributes)Implements java. Factory method for creating Struct objects. |
| private boolean | |
| private Properties | Returns: a new Properties set copied from the parameter but with no derby.* properties.Filter out properties from the passed in set of JDBC attributes to remove any derby.* properties. |
| protected void | finalize()
Overrides java. Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
| private static Object | findService(final String factoryInterface, final String serviceName)
Must be private so that user code can't call this entry point. |
| public final Connection | |
| public boolean | Returns: Current state of auto-commit mode.Implements java. Get the current auto-commit state. |
| public String | Returns: the current catalog name or nullImplements java. Return the Connection's current catalog name. |
| public String | Returns: anull String valuea name)String valueImplements java.
|
| public Properties | Returns: an emptyProperties objectImplements java.
|
| protected final Object | |
| public final ContextManager | |
| public String | Returns: the current schema nameImplements org. Obtain the name of the current schema. |
| protected Database | |
| public String | |
| public int | Returns: 0 if there is no database, the engine type otherwise. @see org.apache.derby.shared.common.reference.EngineTypeGets the EngineType of the connected database. |
| public final int | Returns: The holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMITImplements java. JDBC 3.0 Retrieves the current holdability of ResultSet objects created using this Connection object. |
| private int | Returns: an integer that represents the most recent locator value.Return the current locator value/ 0x800x values are not valid values as they are used to indicate the BLOB is being sent by value, so we skip those values (DERBY-3243) |
| public final LanguageConnectionContext | |
| private HashMap | Returns: the HashMap that contains the locator to LOB object mappingReturn the Hash Map in the root connection |
| public Object | Returns: the LOB Object corresponding to this locator.the integer that represents the LOB locator value. key)Implements org. Get the LOB reference corresponding to the locator. |
| public final InternalDriver | |
| public DatabaseMetaData | Returns: a DatabaseMetaData object for this ConnectionImplements java. A Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc. This information is made available through a DatabaseMetaData object. |
| pack-priv static ModuleFactory | |
| public int | getNetworkTimeout()
Implements org. Retrieves the number of milliseconds the driver will wait for a database request to complete. |
| public int | getPrepareIsolation()
Implements org. Return prepare isolation |
| private String | |
| pack-priv final int | |
| public String | getSchema()
Implements org. Get the name of the current schema. |
| protected final TransactionResourceImpl | |
| public final int | Returns: the current TRANSACTION_* mode valueImplements java. Get this Connection's current transaction isolation mode. |
| public final Map | Returns: type map for this connectionImplements java. Returns the type map for this connection. |
| public final synchronized SQLWarning | Returns: the first SQLWarning or null Synchronization note: Warnings are synchronized on nesting levelImplements java. The first warning reported by calls on this Connection is returned. |
| private void | |
| pack-priv SQLException | |
| pack-priv final SQLException | handleException(Throwable
the exception thrownException, boolean rollback the xact on if autocommit is
on, otherwise rollback stmt but leave xact open (and
continue to hold on to locks). Most of the time, this
will be true, excepting operations on result sets, like
getInt(). rollbackOnAutoCommit)Handle any type of Exception. |
| private void | handleFailoverMaster(TransactionResourceImpl
an instance of TransactionResourceImpl Links the connection
to the database. tr)Used to authorize and verify the privileges of the user and initiate failover. |
| private void | handleFailoverSlave(Database
The database the failover operation will be
performed on database)Used to perform failover on a database in slave replication mode. |
| private void | |
| private void | |
| private void | handleStopReplicationSlave(Database
The database the stop slave operation will be
performed on database, Properties The Attribute set. p)Stop replication slave when called from a client. |
| private void | internalStopReplicationSlave(Database
The database the internal stop slave operation
will be performed on database, Properties The Attribute set. p)Stop replication slave when called from SlaveDatabase. |
| public boolean | |
| public final boolean | Returns: true if the connection is closed; false if it's still openImplements java. Tests to see if a Connection is closed. |
| private boolean | Returns: true if a boot will perform a cryptographic operation on
the database.the attribute set p)Examines boot properties and determines if a boot with the given attributes would entail a cryptographic operation on the database. |
| private boolean | Returns: true if the drop database operation is requested,
false if not.the attribute set p)Examines the boot properties and determines if the given attributes would entail dropping the database. |
| private boolean | Returns: true if a boot will hard upgrade the databasethe attribute set p)Examine boot properties and determine if a boot with the given attributes would entail a hard upgrade. |
| public boolean | isInGlobalTransaction()
Implements org. Is this a global transaction |
| private boolean | Returns: true if the shutdownslave attribute has been set, false otherwise.The attribute set. p)Examine the boot properties and determine if a boot with the given attributes should stop slave replication mode. |
| public final boolean | Returns: true if connection is read-onlyImplements java. Tests to see if the connection is in read-only mode. |
| private boolean | Returns: true if the failover attribute has been set. false otherwise.The attribute set. p)used to verify if the failover attribute has been set. |
| private static boolean | |
| private boolean | |
| private boolean | |
| private boolean | |
| private boolean | Returns: true if the stopSlave attribute has been set, false otherwise.The attribute set. p)Examine the boot properties and determine if a boot with the given attributes should stop slave replication mode. |
| private static boolean | |
| public boolean | Returns: true if the connection is valid, false otherwiseThis should be the time in seconds to wait for the
database operation used to validate the connection to complete
(according to the JDBC4 JavaDoc). This is currently not supported/used. timeout)Implements java. Checks if the connection has not been closed and is still valid. |
| public boolean | Returns: true if this implements the interface or directly or indirectly wraps an object that does.a Class defining an interface. interfaces)Implements java. Returns false unless |
| public String | Returns: the native form of this statementa SQL statement that may contain one or more '?'
parameter placeholders sql)Implements java. A driver may convert the JDBC sql grammar into its system's native SQL grammar prior to sending it; nativeSQL returns the native form of the statement that the driver would have sent. |
| protected void | |
| pack-priv static SQLException | |
| public final CallableStatement | Returns: a new CallableStatement object containing the pre-compiled SQL statementa SQL statement that may contain one or more '?'
parameter placeholders. Typically this statement is a JDBC
function call escape string. sql)Implements java. A SQL stored procedure call statement is handled by creating a CallableStatement for it. |
| public final CallableStatement | Returns: a new CallableStatement object containing the pre-compiled SQL statementa sql, int String object that is the SQL statement to
be sent to the database; may contain on or more '?' parametersa result set type, see ResultSet.TYPE_XXX resultSetType, int a concurrency type, see ResultSet.CONCUR_XXX resultSetConcurrency)Implements java. JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden. |
| public final CallableStatement | Returns: a new CallableStatement object containing the pre-compiled SQL statementa sql, int String object that is the SQL statement to
be sent to the database; may contain on or more '?' parametersa result set type, see ResultSet.TYPE_XXX resultSetType, int a concurrency type, see ResultSet.CONCUR_XXX resultSetConcurrency, int - one of the following ResultSet constants:
ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT resultSetHoldability)Implements java. JDBC 3.0 Same as prepareCall() above, but allows the default result set type, result set concurrency type and result set holdability to be overridden. |
| pack-priv PreparedStatement | |
| public final PreparedStatement | Returns: a new PreparedStatement object containing the pre-compiled statementa SQL statement that may contain one or more '?' IN
parameter placeholders sql)Implements java. A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. |
| public final PreparedStatement | Returns: a new PreparedStatement object containing the pre-compiled SQL statementa sql, int String object that is the SQL statement to
be sent to the database; may contain one or more '?' IN
parametersa result set type, see ResultSet.TYPE_XXX resultSetType, int a concurrency type, see ResultSet.CONCUR_XXX resultSetConcurrency)Implements java. JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden. |
| public final PreparedStatement | Returns: a new PreparedStatement object containing the pre-compiled SQL statementa sql, int String object that is the SQL statement to
be sent to the database; may contain one or more '?' IN
parametersa result set type, see ResultSet.TYPE_XXX resultSetType, int a concurrency type, see ResultSet.CONCUR_XXX resultSetConcurrency, int - one of the following ResultSet constants:
ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT resultSetHoldability)Implements java. JDBC 3.0 Same as prepareStatement() above, but allows the default result set type, result set concurrency type and result set holdability to be overridden. |
| public final PreparedStatement | Returns: A new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys designated by the given array of column indexesAn 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. Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. |
| public final PreparedStatement | Returns: A new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys designated by the given array of column namesAn 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. Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. |
| public final PreparedStatement | Returns: A new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keysA SQL statement that may contain one or more ? IN parameter placeholders sql, int A flag indicating whether auto-generated keys
should be returned autoGeneratedKeys)Implements java. Creates a default PreparedStatement object that has the capability to retieve auto-generated keys. |
| private PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, String[] columnNames)
|
| private LanguageConnectionContext | |
| private EmbedConnectionContext | |
| public void | releaseSavepoint(Savepoint
The Savepoint object to be removed savepoint)Implements java. Removes the given Savepoint object from the current transaction. |
| pack-priv void | |
| public void | removeLOBMapping(int
an integer that represents the locator that needs to be
removed from the table. key)Remove the key(LOCATOR) from the hash table. |
| private static void | removePersistentService(final String name)
Must be private so that user code can't call this entry point. |
| private Properties | Returns: clone sans encryption propertiesthe attribute set p)Remove any encryption or upgarde properties from the given properties |
| public void | resetFromPool()
Implements org. Reset the connection before it is returned from a PooledConnection to a new application request (wrapped by a BrokeredConnection). |
| protected final void | |
| public void | rollback()
Implements java. Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection. |
| public void | rollback(Savepoint
The Savepoint object to rollback to savepoint)Implements java. Undoes all changes made after the given Savepoint object was set. |
| public final void | |
| public void | setAutoCommit(boolean
true enables auto-commit; false disables
auto-commit. autoCommit)Implements java. If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. |
| public void | setCatalog(String
the name of a catalog (subspace in this
catalog)Connection object's database) in which to workImplements java. A sub-space of this Connection's database may be selected by setting a catalog name. |
| public void | setClientInfo(String
a property key name, String Stringa property value value)StringImplements java.
|
| public void | setClientInfo(Properties
a properties)Properties object with the
properties to setImplements java.
|
| public void | setDrdaID(String
The DRDA identifier drdaID)Implements org. Set the DRDA identifier for this connection. |
| public final void | setHoldability(int
A ResultSet holdability constant, one of ResultSet.HOLD_CURSORS_OVER_COMMIT
or ResultSet.CLOSE_CURSORS_AT_COMMIT holdability)Implements java. JDBC 3.0 Changes the holdability of ResultSet objects created using this Connection object to the given holdability. |
| public final void | |
| public void | setNetworkTimeout(Executor
The executor, int Executor implementation which will
be used by setNetworkTimeout.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 org. Sets the maximum period a |
| public void | setPrepareIsolation(int
Isolation level to change to. level is the DB2 level
specified in the package names which happen to correspond
to our internal levels. If
level == TransactionControl.UNSPECIFIED_ISOLATION,
the statement won't be prepared with an isolation level. level)Implements org. Set the transaction isolation level that will be used for the next prepare. |
| public final void | setReadOnly(boolean
true enables read-only mode; false disables
read-only mode. readOnly)Implements java. You can put a connection in read-only mode as a hint to enable database optimizations. |
| private int | |
| public Savepoint | Returns: The new Savepoint objectImplements java. Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it. |
| public Savepoint | Returns: The new Savepoint objectA String containing the name of the savepoint name)Implements java. Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it. |
| public void | setSchema(String
The new default schema schemaName)Implements org. Set the default schema for the Connection. |
| public void | setTransactionIsolation(int
one of the TRANSACTION_* isolation values with the
exception of TRANSACTION_NONE; some databases may not support
other values level)Implements java. You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values. |
| public final void | setTypeMap(Map<K, V>
the map)java.util.Map object to install
as the replacement for this Connection
object's default type mapImplements java. Install a type-map object as the default type-map for this connection. |
| protected final void | |
| private static void | |
| private static boolean | startPersistentService(final String serviceName, final Properties properties)
Must be private so that user code can't call this entry point. |
| public static String | Returns: the database name without any sub-sub-protocol prefixesa database name dbname)Strips any sub-sub-protocol prefix from a database name. |
| public String | Returns: a string representation for this connectionOverrides java. Get a String representation that uniquely identifies this connection. |
| public final boolean | transactionIsIdle()
returns false if there is an underlying transaction and that transaction has done work. |
| public <T> T | Returns: an object that implements the interfacea Class defining an interface interfaces)Implements java. Returns |
| private void | |
| private void | |
| private static boolean | |
| public final void | xa_commit(boolean onePhase)
Do not use this method directly use XATransactionState.xa_commit instead because it also maintains/cancels the timout task which is scheduled to cancel/rollback the global transaction. |
| public final int | xa_prepare()
Do not use this method directly use XATransactionState.xa_prepare instead because it also maintains/cancels the timeout task which is scheduled to cancel/rollback the global transaction. |
| public final void | xa_rollback()
Do not use this method directly use XATransactionState.xa_rollback instead because it also maintains/cancels the timout task which is scheduled to cancel/rollback the global transaction. |