Class EmbedConnection
- All Implemented Interfaces:
AutoCloseable, Connection, Wrapper, EngineConnection
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
- JDBC 4.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate boolean///////////////////////////////////////////////////////private ConnectionThe Connection object the application is using when accessing the database through this connection.(package private) booleanprivate intprivate StringCached string representation of the connection id(package private) DatabaseMetaData///////////////////////////////////////////////////////protected static final StandardExceptionprivate InternalDriverFactory for JDBC objects to be created.private intprivate WeakHashMap<Object, Object> Map to keep track of all the lobs associated with this connection.static final LowMemoryLow memory state object for connection requests.(package private) booleanstatic final SQLExceptionStatic exception to be thrown when a Connection request can not be fulfilled due to lack of memory.private static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intAn increasing counter to assign to a ResultSet on its creation.(package private) final EmbedConnection///////////////////////////////////////////////////////private SQLWarning(package private) TransactionResourceImplprivate booleanFields inherited from interface Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
ConstructorsConstructorDescriptionEmbedConnection(EmbedConnection inputConnection) Create a new connection based off of the connection passed in.EmbedConnection(InternalDriver driver, String url, Properties info) /////////////////////////////////////////////////////// -
Method Summary
Modifier and TypeMethodDescriptionvoid/////////////////////////////////////////////////////////////////(package private) voidaddLobFile(LOBFile lobFile) Add a temporary lob file to the lobFiles set.intaddLOBMapping(Object LOBReference) Add the locator and the corresponding LOB object into the HashMap(package private) voidaddLOBReference(Object lobReference) Adds an entry of the lob in WeakHashMap.final voidaddWarning(SQLWarning newWarning) Add a warning to the current list of warnings, to follow this note from Connection.getWarnings.protected voidBegin aborting the connectionprivate booleanbootDatabase(Properties info, boolean softAuthenticationBoot) Boot database.voidCancels the current running statement.private voidExamines the boot properties looking for conflicting cryptographic options and commands.private voidcheckDatabaseBooted(Database database, String operation, String dbname) Check that a database has already been booted.private voidcheckDatabaseCreatePrivileges(String user, String dbname) Checks that a user has the system privileges to create a database.voidCheck if the transaction is active so that we cannot close down the connection.protected final voidRaises an exception if the connection is closed.private voidcheckIsDBOwner(int operation) Check if actual authenticationId is equal to the database owner's.private voidcheckUserCredentials(boolean creatingDatabase, String dbname, Properties userInfo) private voidIf applicable, check that we don't connect with a user name that equals a role.private voidClear the HashMap of all entries.final voidAfter this call, getWarnings returns null until a new warning is reported for this Connection.voidclose()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 voidvoidcommit()Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection.protected voidIf in autocommit, then commit.protected voidif a commit is needed, perform it.private SavepointcommonSetSavepointCode(String name, boolean 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 booleancompareDatabaseNames(String leftDBName, String rightDBName) Compare two user-specified database names to see if they identify the same database.createArrayOf(String typeName, Object[] elements) Constructs an object that implements theBlobinterface.private booleanExamine the attributes set provided for illegal boot combinations and determine if this is a create boot.Constructs an object that implements theClobinterface.private DatabasecreateDatabase(String dbname, Properties info) Create a new database.private static ObjectcreatePersistentService(String factoryInterface, String serviceName, Properties properties) Privileged startup.final StatementSQL statements without parameters are normally executed using Statement objects.final StatementcreateStatement(int resultSetType, int resultSetConcurrency) JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.final StatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) 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.createStruct(String typeName, Object[] attributes) private booleanemptyCredential(String credential) Forbid empty or null usernames and passwords.private PropertiesfilterProperties(Properties inputSet) Filter out properties from the passed in set of JDBC attributes to remove any derby.* properties.protected voidfinalize()private static ObjectfindService(String factoryInterface, String serviceName) Privileged service lookup.final ConnectionbooleanGet the current auto-commit state.Return the Connection's current catalog name.getClientInfoalways returns an emptyPropertiesobject since Derby doesn't support ClientInfoProperties.getClientInfo(String name) getClientInfoalways returns anull Stringsince Derby doesn't support ClientInfoProperties.protected final Objectfinal ContextManagerReturn the context manager for this connection.Obtain the name of the current schema.protected DatabaseReturn the dbname for this connection.intGets the EngineType of the connected database.final intJDBC 3.0 Retrieves the current holdability of ResultSet objects created using this Connection object.private intReturn 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)Return the Hash Map in the root connectiongetLOBMapping(int key) Get the LOB reference corresponding to the locator.final InternalDriverA Connection's database is able to provide information describing its tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, etc.(package private) static ModuleFactoryPrivileged Monitor lookup.intintReturn prepare isolationprivate String(package private) final intReturn a unique order number for a result set.Get the name of the current schema.protected final TransactionResourceImplgetTR()final intGet this Connection's current transaction isolation mode.Returns the type map for this connection.final SQLWarningThe first warning reported by calls on this Connection is returned.private void(package private) SQLExceptionhandleException(Throwable thrownException) (package private) final SQLExceptionhandleException(Throwable thrownException, boolean rollbackOnAutoCommit) Handle any type of Exception.private voidUsed to authorize and verify the privileges of the user and initiate failover.private voidhandleFailoverSlave(Database database) Used to perform failover on a database in slave replication mode.private voidprivate voidprivate voidhandleStopReplicationSlave(Database database, Properties p) Stop replication slave when called from a client.private voidinternalStopReplicationSlave(Database database, Properties p) Stop replication slave when called from SlaveDatabase.booleanReturn true if the connection is abortingfinal booleanisClosed()Tests to see if a Connection is closed.private booleanExamines boot properties and determines if a boot with the given attributes would entail a cryptographic operation on the database.private booleanExamines the boot properties and determines if the given attributes would entail dropping the database.private booleanExamine boot properties and determine if a boot with the given attributes would entail a hard upgrade.booleanIs this a global transactionprivate booleanExamine the boot properties and determine if a boot with the given attributes should stop slave replication mode.final booleanTests to see if the connection is in read-only mode.private booleanused to verify if the failover attribute has been set.private static booleanisSet(Properties p, String attribute) Tells if the attribute/property has been set.private booleanprivate booleanprivate booleanprivate booleanExamine the boot properties and determine if a boot with the given attributes should stop slave replication mode.private static booleanisTrue(Properties p, String attribute) Tells if the attribute/property has the valuetrue.booleanisValid(int timeout) Checks if the connection has not been closed and is still valid.booleanisWrapperFor(Class<?> interfaces) Returns false unlessinterfacesis implementedA 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 voidif auto commit is on, remember that we need to commit the current statement.(package private) static SQLExceptionnewSQLException(String messageId, Object... args) final CallableStatementprepareCall(String sql) A SQL stored procedure call statement is handled by creating a CallableStatement for it.final CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency) JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.final CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 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.(package private) PreparedStatementfinal PreparedStatementprepareStatement(String sql) A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object.final PreparedStatementprepareStatement(String sql, int autoGeneratedKeys) Creates a default PreparedStatement object that has the capability to retieve auto-generated keys.final PreparedStatementprepareStatement(String sql, int[] columnIndexes) Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.final PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency) JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.final PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) 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.private PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, String[] columnNames) final PreparedStatementprepareStatement(String sql, String[] columnNames) Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array.private LanguageConnectionContextPrivate, privileged lookup of the lcc..private EmbedConnectionContextvoidreleaseSavepoint(Savepoint savepoint) Removes the given Savepoint object from the current transaction.(package private) voidremoveLobFile(LOBFile lobFile) Remove LOBFile from the lobFiles set.voidremoveLOBMapping(int key) Remove the key(LOCATOR) from the hash table.private static voidPrivileged shutdown.private PropertiesRemove any encryption or upgarde properties from the given propertiesvoidReset the connection before it is returned from a PooledConnection to a new application request (wrapped by a BrokeredConnection).protected final voidvoidrollback()Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection.voidUndoes all changes made after the given Savepoint object was set.final voidsetApplicationConnection(Connection applicationConnection) voidsetAutoCommit(boolean autoCommit) If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions.voidsetCatalog(String catalog) A sub-space of this Connection's database may be selected by setting a catalog name.voidsetClientInfo(String name, String value) setClientInfowill always throw aSQLClientInfoExceptionsince Derby does not support any properties.voidsetClientInfo(Properties properties) setClientInfowill throw aSQLClientInfoExceptionunless thepropertiesparameter is empty, since Derby does not support any properties.voidSet the DRDA identifier for this connection.final voidsetHoldability(int holdability) JDBC 3.0 Changes the holdability of ResultSet objects created using this Connection object to the given holdability.final voidClose the connection when processing errors, or when closing a nested connection.voidsetNetworkTimeout(Executor executor, int milliseconds) voidsetPrepareIsolation(int level) Set the transaction isolation level that will be used for the next prepare.final voidsetReadOnly(boolean readOnly) You can put a connection in read-only mode as a hint to enable database optimizations.private intsetResultSetType(int resultSetType) Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.setSavepoint(String name) Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.voidSet the default schema for the Connection.voidsetTransactionIsolation(int level) You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.final voidsetTypeMap(Map map) Install a type-map object as the default type-map for this connection.protected final voidInstall the context manager for this thread.private static voidsleep(long millis) Puts the current thread to sleep.private static booleanstartPersistentService(String serviceName, Properties properties) Privileged startup.static StringstripSubSubProtocolPrefix(String dbname) Strips any sub-sub-protocol prefix from a database name.toString()Get a String representation that uniquely identifies this connection.final booleanreturns false if there is an underlying transaction and that transaction has done work.<T> TReturnsthisif this class implements the interfaceprivate voidverifySavepointArg(Savepoint savepoint) private voidprivate static booleanvetTrue(Properties p, String attribute) Returns true if the attribute exists and is set to true.final voidxa_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.final intDo 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.final voidDo 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.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Connection
beginRequest, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
exceptionClose
-
NO_MEM
Static exception to be thrown when a Connection request can not be fulfilled due to lack of memory. A static exception as the lack of memory would most likely cause another OutOfMemoryException and if there is not enough memory to create the OOME exception then something like the VM dying could occur. Simpler just to throw a static. -
memoryState
Low memory state object for connection requests. -
dbMetadata
DatabaseMetaData dbMetadata/////////////////////////////////////////////////////// -
tr
-
lobHashMap
-
lobHMKey
private int lobHMKey -
lobReferences
Map to keep track of all the lobs associated with this connection. These lobs will be cleared after the transaction is no longer valid or when connection is closed -
lobFiles
-
active
private boolean active/////////////////////////////////////////////////////// -
aborting
private boolean aborting -
autoCommit
boolean autoCommit -
needCommit
boolean needCommit -
usingNoneAuth
private boolean usingNoneAuth -
connectionHoldAbility
private int connectionHoldAbility -
rootConnection
/////////////////////////////////////////////////////// -
topWarning
-
factory
Factory for JDBC objects to be created. -
applicationConnection
The Connection object the application is using when accessing the database through this connection. In most cases this will be equal to this. When Connection pooling is being used, then it will be set to the Connection object handed to the application. It is used for the getConnection() methods of various JDBC objects. -
resultSetId
private int resultSetIdAn increasing counter to assign to a ResultSet on its creation. Used for ordering ResultSets returned from a procedure, always returned in order of their creation. Is maintained at the root connection. -
connString
Cached string representation of the connection id -
OP_ENCRYPT
private static final int OP_ENCRYPT- See Also:
-
OP_SHUTDOWN
private static final int OP_SHUTDOWN- See Also:
-
OP_HARD_UPGRADE
private static final int OP_HARD_UPGRADE- See Also:
-
OP_REPLICATION
private static final int OP_REPLICATION- See Also:
-
OP_DECRYPT
private static final int OP_DECRYPT- See Also:
-
-
Constructor Details
-
EmbedConnection
///////////////////////////////////////////////////////- Throws:
SQLException
-
EmbedConnection
Create a new connection based off of the connection passed in. Initializes state based on input connection, and copies appropriate object pointers. This is only used for nested connections.- Parameters:
inputConnection- the input connection
-
-
Method Details
-
checkDatabaseBooted
private void checkDatabaseBooted(Database database, String operation, String dbname) throws SQLException Check that a database has already been booted. Throws an exception otherwise- Parameters:
database- The database that should have been bootedoperation- The operation that requires that the database has already been booted, used in the exception message if not booteddbname- The name of the database that should have been booted, used in the exception message if not booted- Throws:
SQLException- thrown if database is not booted
-
createBoot
Examine the attributes set provided for illegal boot combinations and determine if this is a create boot.- Parameters:
p- the attribute set.- Returns:
- true iff the attribute create=true is provided. This means create a standard database. In other cases, returns false.
- Throws:
SQLException- Throw if more than one of create, createFrom, restoreFrom and rollForwardRecoveryFrom is used simultaneously.
Also, throw if (re)encryption is attempted with one of createFrom, restoreFrom and rollForwardRecoveryFrom.
-
handleDBNotFound
- Throws:
SQLException
-
isDropDatabase
Examines the boot properties and determines if the given attributes would entail dropping the database.- Parameters:
p- the attribute set- Returns:
trueif the drop database operation is requested,falseif not.
-
isCryptoBoot
Examines boot properties and determines if a boot with the given attributes would entail a cryptographic operation on the database.- Parameters:
p- the attribute set- Returns:
trueif a boot will perform a cryptographic operation on the database.- Throws:
SQLException
-
isHardUpgradeBoot
Examine boot properties and determine if a boot with the given attributes would entail a hard upgrade.- Parameters:
p- the attribute set- Returns:
- true if a boot will hard upgrade the database
-
isStartReplicationSlaveBoot
-
isStartReplicationMasterBoot
-
isReplicationFailover
used to verify if the failover attribute has been set.- Parameters:
p- The attribute set.- Returns:
- true if the failover attribute has been set. false otherwise.
-
isStopReplicationMasterBoot
-
isStopReplicationSlaveBoot
Examine the boot properties and determine if a boot with the given attributes should stop slave replication mode.- Parameters:
p- The attribute set.- Returns:
- true if the stopSlave attribute has been set, false otherwise.
-
isInternalShutdownSlaveDatabase
Examine the boot properties and determine if a boot with the given attributes should stop slave replication mode. A connection with this property should only be made from SlaveDatabase. Make sure to call SlaveDatabase.verifyShutdownSlave() to verify that this connection is not made from a client.- Parameters:
p- The attribute set.- Returns:
- true if the shutdownslave attribute has been set, false otherwise.
-
isSet
Tells if the attribute/property has been set. -
isTrue
Tells if the attribute/property has the valuetrue. -
vetTrue
Returns true if the attribute exists and is set to true. Raises an exception if the attribute exists and is set to something else.- Throws:
SQLException
-
getReplicationOperation
- Throws:
StandardException
-
handleStartReplicationMaster
private void handleStartReplicationMaster(TransactionResourceImpl tr, Properties p) throws SQLException - Throws:
SQLException
-
handleStopReplicationMaster
private void handleStopReplicationMaster(TransactionResourceImpl tr, Properties p) throws SQLException - Throws:
SQLException
-
handleStopReplicationSlave
private void handleStopReplicationSlave(Database database, Properties p) throws StandardException, SQLException Stop replication slave when called from a client. Stops replication slave mode, provided that the database is in replication slave mode and has lost connection with the master database. If the connection with the master is up, the call to this method will be refused by raising an exception. The reason for refusing the stop command if the slave is connected with the master is that we cannot authenticate the user on the slave side (because the slave database has not been fully booted) whereas authentication is not a problem on the master side. If not refused, this operation will cause SlaveDatabase to call internalStopReplicationSlave- Parameters:
database- The database the stop slave operation will be performed onp- The Attribute set.- Throws:
StandardException- Thrown on error, if not in replication slave mode or if the network connection with the master is not downSQLException- Thrown if the database has not been booted or if stopSlave is performed successfully
-
internalStopReplicationSlave
private void internalStopReplicationSlave(Database database, Properties p) throws StandardException, SQLException Stop replication slave when called from SlaveDatabase. Called when slave replication mode has been stopped, and all that remains is to shutdown the database. This happens if handleStopReplicationSlave has successfully requested the slave to stop, if the replication master has requested the slave to stop using the replication network, or if a fatal exception has occurred in the database.- Parameters:
database- The database the internal stop slave operation will be performed onp- The Attribute set.- Throws:
StandardException- Thrown on error or if not in replication slave modeSQLException- Thrown if the database has not been booted or if this connection was not made internally from SlaveDatabase
-
handleFailoverMaster
private void handleFailoverMaster(TransactionResourceImpl tr) throws SQLException, StandardException Used to authorize and verify the privileges of the user and initiate failover.- Parameters:
tr- an instance of TransactionResourceImpl Links the connection to the database.- Throws:
StandardException- 1) If the failover succeeds, an exception is thrown to indicate that the master database was shutdown after a successful failover 2) If a failure occurs during network communication with slave.SQLException- 1) Thrown upon a authorization failure.
-
handleFailoverSlave
Used to perform failover on a database in slave replication mode. Performs failover, provided that the database is in replication slave mode and has lost connection with the master database. If the connection with the master is up, the call to this method will be refused by raising an exception. The reason for refusing the failover command if the slave is connected with the master is that we cannot authenticate the user on the slave side (because the slave database has not been fully booted) whereas authentication is not a problem on the master side. If not refused, this method will apply all operations received from the master and complete the booting of the database so that it can be connected to.- Parameters:
database- The database the failover operation will be performed on- Throws:
SQLException- Thrown on error, if not in replication slave mode or if the network connection with the master is not down
-
removePhaseTwoProps
Remove any encryption or upgarde properties from the given properties- Parameters:
p- the attribute set- Returns:
- clone sans encryption properties
-
checkUserCredentials
private void checkUserCredentials(boolean creatingDatabase, String dbname, Properties userInfo) throws SQLException - Throws:
SQLException
-
emptyCredential
Forbid empty or null usernames and passwords.
-
compareDatabaseNames
Compare two user-specified database names to see if they identify the same database.- Throws:
SQLException
-
checkUserIsNotARole
If applicable, check that we don't connect with a user name that equals a role.- Throws:
SQLException- Will throw if the current authorization id inlcc(which is already normalized to case normal form - CNF) equals an existing role name (which is also stored in CNF).
-
checkIsDBOwner
Check if actual authenticationId is equal to the database owner's.- Parameters:
operation- attempted operation which needs database owner powers- Throws:
SQLException- if actual authenticationId is different from authenticationId of database owner.
-
getEngineType
public int getEngineType()Gets the EngineType of the connected database.- Returns:
- 0 if there is no database, the engine type otherwise. @see org.apache.derby.iapi.reference.EngineType
-
createStatement
SQL statements without parameters are normally executed using Statement objects. If the same SQL statement is executed many times, it is more efficient to use a PreparedStatement JDBC 2.0 Result sets created using the returned Statement will have forward-only type, and read-only concurrency, by default.- Specified by:
createStatementin interfaceConnection- Returns:
- a new Statement object
- Throws:
SQLException- if a database-access error occurs.
-
createStatement
public final Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException JDBC 2.0 Same as createStatement() above, but allows the default result set type and result set concurrency type to be overridden.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXX- Returns:
- a new Statement object
- Throws:
SQLException- if a database-access error occurs.
-
createStatement
public final Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException 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.- Specified by:
createStatementin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXXresultSetHoldability- a holdability type, ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT- Returns:
- a new Statement object
- Throws:
SQLException- if a database-access error occurs.
-
prepareStatement
A SQL statement with or without IN parameters can be pre-compiled and stored in a PreparedStatement object. This object can then be used to efficiently execute this statement multiple times.Note: This method is optimized for handling parametric SQL statements that benefit from precompilation. If the driver supports precompilation, prepareStatement will send the statement to the database for precompilation. Some drivers may not support precompilation. In this case, the statement may not be sent to the database until the PreparedStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions. JDBC 2.0 Result sets created using the returned PreparedStatement will have forward-only type, and read-only concurrency, by default.
- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- a SQL statement that may contain one or more '?' IN parameter placeholders- Returns:
- a new PreparedStatement object containing the pre-compiled statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException JDBC 2.0 Same as prepareStatement() above, but allows the default result set type and result set concurrency type to be overridden.- Specified by:
prepareStatementin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXX- Returns:
- a new PreparedStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException 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.- Specified by:
prepareStatementin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXXresultSetHoldability- - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT- Returns:
- a new PreparedStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. This array is ignored if the SQL statement is not an INSERT statement JDBC 3.0- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- An SQL statement that may contain one or more ? IN parameter placeholderscolumnIndexes- An array of column indexes indicating the columns that should be returned from the inserted row or rows- 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 indexes
- Throws:
SQLException- Thrown on error.
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException Creates a default PreparedStatement object capable of returning the auto-generated keys designated by the given array. This array contains the names of the columns in the target table that contain the auto-generated keys that should be returned. This array is ignored if the SQL statement is not an INSERT statement JDBC 3.0- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- An SQL statement that may contain one or more ? IN parameter placeholderscolumnNames- An array of column names indicating the columns that should be returned from the inserted row or rows- 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 names
- Throws:
SQLException- Thrown on error.
-
prepareStatement
public final PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException Creates a default PreparedStatement object that has the capability to retieve auto-generated keys. The given constant tells the driver whether it should make auto-generated keys available for retrieval. This parameter is ignored if the SQL statement is not an INSERT statement. JDBC 3.0- Specified by:
prepareStatementin interfaceConnection- Parameters:
sql- A SQL statement that may contain one or more ? IN parameter placeholdersautoGeneratedKeys- A flag indicating whether auto-generated keys should be returned- Returns:
- A new PreparedStatement object, containing the pre-compiled SQL statement, that will have the capability of returning auto-generated keys
- Throws:
SQLException- Feature not implemented for now.
-
prepareStatement
private PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, String[] columnNames) throws SQLException - Throws:
SQLException
-
prepareCall
A SQL stored procedure call statement is handled by creating a CallableStatement for it. The CallableStatement provides methods for setting up its IN and OUT parameters, and methods for executing it.Note: This method is optimized for handling stored procedure call statements. Some drivers may send the call statement to the database when the prepareCall is done; others may wait until the CallableStatement is executed. This has no direct affect on users; however, it does affect which method throws certain SQLExceptions. JDBC 2.0 Result sets created using the returned CallableStatement will have forward-only type, and read-only concurrency, by default.
- Specified by:
prepareCallin interfaceConnection- Parameters:
sql- a SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is a JDBC function call escape string.- Returns:
- a new CallableStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareCall
public final CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException JDBC 2.0 Same as prepareCall() above, but allows the default result set type and result set concurrency type to be overridden.- Specified by:
prepareCallin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXX- Returns:
- a new CallableStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
prepareCall
public final CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException 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.- Specified by:
prepareCallin interfaceConnection- Parameters:
resultSetType- a result set type, see ResultSet.TYPE_XXXresultSetConcurrency- a concurrency type, see ResultSet.CONCUR_XXXresultSetHoldability- - one of the following ResultSet constants: ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT- Returns:
- a new CallableStatement object containing the pre-compiled SQL statement
- Throws:
SQLException- if a database-access error occurs.
-
nativeSQL
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.- Specified by:
nativeSQLin interfaceConnection- Parameters:
sql- a SQL statement that may contain one or more '?' parameter placeholders- Returns:
- the native form of this statement
- Throws:
SQLException
-
setAutoCommit
If a connection is in auto-commit mode, then all its SQL statements will be executed and committed as individual transactions. Otherwise, its SQL statements are grouped into transactions that are terminated by either commit() or rollback(). By default, new connections are in auto-commit mode. The commit occurs when the statement completes or the next execute occurs, whichever comes first. In the case of statements returning a ResultSet, the statement completes when the last row of the ResultSet has been retrieved or the ResultSet has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output param values have been retrieved.- Specified by:
setAutoCommitin interfaceConnection- Parameters:
autoCommit- true enables auto-commit; false disables auto-commit.- Throws:
SQLException- if a database-access error occurs.
-
getAutoCommit
Get the current auto-commit state.- Specified by:
getAutoCommitin interfaceConnection- Returns:
- Current state of auto-commit mode.
- Throws:
SQLException- See Also:
-
commit
Commit makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.- Specified by:
commitin interfaceConnection- Throws:
SQLException- if a database-access error occurs.- See Also:
-
rollback
Rollback drops all changes made since the previous commit/rollback and releases any database locks currently held by the Connection. This method should only be used when auto commit has been disabled.- Specified by:
rollbackin interfaceConnection- Throws:
SQLException- if a database-access error occurs.- See Also:
-
close
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.Note: A Connection is automatically closed when it is garbage collected. Certain fatal errors also result in a closed Connection.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection- Throws:
SQLException- if a database-access error occurs.
-
checkForTransactionInProgress
Check if the transaction is active so that we cannot close down the connection. If auto-commit is on, the transaction is committed when the connection is closed, so it is always OK to close the connection in that case. Otherwise, throw an exception if a transaction is in progress.- Throws:
SQLException- if this transaction is active and the connection cannot be closed
-
close
- Throws:
SQLException
-
isClosed
public final boolean isClosed()Tests to see if a Connection is closed.- Specified by:
isClosedin interfaceConnection- Returns:
- true if the connection is closed; false if it's still open
-
getMetaData
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.- Specified by:
getMetaDatain interfaceConnection- Returns:
- a DatabaseMetaData object for this Connection
- Throws:
SQLException- if a database-access error occurs.
-
getHoldability
JDBC 3.0 Retrieves the current holdability of ResultSet objects created using this Connection object.- Specified by:
getHoldabilityin interfaceConnection- Returns:
- The holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
- Throws:
SQLException
-
setHoldability
JDBC 3.0 Changes the holdability of ResultSet objects created using this Connection object to the given holdability.- Specified by:
setHoldabilityin interfaceConnection- Parameters:
holdability- A ResultSet holdability constant, one of ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT- Throws:
SQLException
-
setReadOnly
You can put a connection in read-only mode as a hint to enable database optimizations.Note: setReadOnly cannot be called while in the middle of a transaction.
- Specified by:
setReadOnlyin interfaceConnection- Parameters:
readOnly- true enables read-only mode; false disables read-only mode.- Throws:
SQLException- if a database-access error occurs.
-
isReadOnly
Tests to see if the connection is in read-only mode.- Specified by:
isReadOnlyin interfaceConnection- Returns:
- true if connection is read-only
- Throws:
SQLException- if a database-access error occurs.
-
setCatalog
A sub-space of this Connection's database may be selected by setting a catalog name. If the driver does not support catalogs it will silently ignore this request.- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException- if a database-access error occurs.
-
getCatalog
Return the Connection's current catalog name.- Specified by:
getCatalogin interfaceConnection- Returns:
- the current catalog name or null
- Throws:
SQLException- if a database-access error occurs.
-
setTransactionIsolation
You can call this method to try to change the transaction isolation level using one of the TRANSACTION_* values.Note: setTransactionIsolation causes the current transaction to commit if the isolation level is changed. Otherwise, if the requested isolation level is the same as the current isolation level, this method is a no-op.
- Specified by:
setTransactionIsolationin interfaceConnection- Parameters:
level- one of the TRANSACTION_* isolation values with the exception of TRANSACTION_NONE; some databases may not support other values- Throws:
SQLException- if a database-access error occurs.- See Also:
-
getTransactionIsolation
Get this Connection's current transaction isolation mode.- Specified by:
getTransactionIsolationin interfaceConnection- Returns:
- the current TRANSACTION_* mode value
- Throws:
SQLException- if a database-access error occurs.
-
getWarnings
The first warning reported by calls on this Connection is returned.Note: Subsequent warnings will be chained to this SQLWarning.
- Specified by:
getWarningsin interfaceConnection- Returns:
- the first SQLWarning or null Synchronization note: Warnings are synchronized on nesting level
- Throws:
SQLException
-
clearWarnings
After this call, getWarnings returns null until a new warning is reported for this Connection. Synchronization node: Warnings are synchonized on nesting level- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException
-
setTypeMap
Install a type-map object as the default type-map for this connection. JDBC 2.0 - java.util.Map requires JDK 1- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException- Feature not implemented for now.
-
addWarning
Add a warning to the current list of warnings, to follow this note from Connection.getWarnings. Note: Subsequent warnings will be chained to this SQLWarning.- Specified by:
addWarningin interfaceEngineConnection- Parameters:
newWarning- Warning to be added, will be chained to any existing warnings.- See Also:
-
getDBName
Return the dbname for this connection.- Returns:
- String The dbname for this connection.
-
getLanguageConnection
-
checkIfClosed
Raises an exception if the connection is closed.- Throws:
SQLException- if the connection is closed
-
handleException
- Throws:
SQLException
-
handleException
final SQLException handleException(Throwable thrownException, boolean rollbackOnAutoCommit) throws SQLException Handle any type of Exception.- Inform the contexts of the error
- Throw an Util based upon the thrown exception.
- Parameters:
thrownException- the exceptionrollbackOnAutoCommit- 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().- Throws:
SQLException
-
setInactive
public final void setInactive()Close the connection when processing errors, or when closing a nested connection.This only marks it as closed and frees up its resources; any closing of the underlying connection or commit work is assumed to be done elsewhere. Called from EmbedConnectionContext's cleanup routine, and by proxy.close().
-
finalize
-
needCommit
protected void needCommit()if auto commit is on, remember that we need to commit the current statement. -
commitIfNeeded
if a commit is needed, perform it. Must have connection synchonization and context set up already.- Throws:
SQLException- if commit returns error
-
commitIfAutoCommit
If in autocommit, then commit. Used to force a commit after a result set closes in autocommit mode. The needCommit mechanism does not work correctly as there are times with cursors (like a commit, followed by a next, followed by a close) where the system does not think it needs a commit but we need to force the commit on close. It seemed safer to just force a commit on close rather than count on keeping the needCommit flag correct for all cursor cases. Must have connection synchonization and context set up already.- Throws:
SQLException- if commit returns error
-
getConnectionSynchronization
-
setupContextStack
Install the context manager for this thread. Check connection status here.- Throws:
SQLException- if fails
-
restoreContextStack
- Throws:
SQLException
-
createDatabase
Create a new database.- Parameters:
dbname- the database nameinfo- the properties- Returns:
- Database The newly created database or null.
- Throws:
SQLException- if fails to create database
-
checkDatabaseCreatePrivileges
Checks that a user has the system privileges to create a database. To perform this check the following policy grants are required- to run the encapsulated test: permission javax.security.auth.AuthPermission "doAsPrivileged";
- to resolve relative path names: permission java.util.PropertyPermission "user.dir", "read";
- to canonicalize path names: permission java.io.FilePermission "...", "read";
In addition, for the test to succeed
- the given user needs to be covered by a grant: principal org.apache.derby.authentication.SystemPrincipal "..." {}
- that lists a permission covering the database location: permission org.apache.derby.security.DatabasePermission "directory:...", "create";
- Parameters:
user- The user to be checked for database create privilegesdbname- the name of the database to create- Throws:
SQLException- if the privileges check fails
-
sleep
private static void sleep(long millis) Puts the current thread to sleep.NOTE: This method guarantees that the thread sleeps at least
millismilliseconds.- Parameters:
millis- milliseconds to sleep
-
stripSubSubProtocolPrefix
Strips any sub-sub-protocol prefix from a database name.- Parameters:
dbname- a database name- Returns:
- the database name without any sub-sub-protocol prefixes
- Throws:
NullPointerException- if dbname is null
-
bootDatabase
Boot database.- Parameters:
info- boot propertiessoftAuthenticationBoot- If true, don't fail soft upgrade due to missing features (phase one of two phased hard upgrade boot).- 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.
- Throws:
Throwable- if anything else is wrong.
-
prepareMetaDataStatement
- Throws:
SQLException
-
getLocalDriver
-
getContextManager
Return the context manager for this connection. -
filterProperties
Filter out properties from the passed in set of JDBC attributes to remove any derby.* properties. This is to ensure that setting derby.* properties does not work this way, it's not a defined way to set such properties and could be a secuirty hole in allowing remote connections to override system, application or database settings.- Returns:
- a new Properties set copied from the parameter but with no derby.* properties.
-
getDatabase
-
getTR
-
pushConnectionContext
-
setApplicationConnection
-
getApplicationConnection
-
setDrdaID
Description copied from interface:EngineConnectionSet the DRDA identifier for this connection.- Specified by:
setDrdaIDin interfaceEngineConnection
-
isInGlobalTransaction
public boolean isInGlobalTransaction()Description copied from interface:EngineConnectionIs this a global transaction- Specified by:
isInGlobalTransactionin interfaceEngineConnection- Returns:
- true if this is a global XA transaction
- See Also:
-
resetFromPool
Reset the connection before it is returned from a PooledConnection to a new application request (wrapped by a BrokeredConnection). Examples of reset covered here is dropping session temporary tables and reseting IDENTITY_VAL_LOCAL. Most JDBC level reset is handled by calling standard java.sql.Connection methods from EmbedPooledConnection.- Specified by:
resetFromPoolin interfaceEngineConnection- Throws:
SQLException
-
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.- Returns:
- One of
XATransactionController.XA_OKorXATransactionController.XA_RDONLY - Throws:
SQLException
-
xa_commit
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.- Throws:
SQLException
-
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.- Throws:
SQLException
-
transactionIsIdle
public final boolean transactionIsIdle()returns false if there is an underlying transaction and that transaction has done work. True if there is no underlying transaction or that underlying transaction is idle -
setResultSetType
private int setResultSetType(int resultSetType) -
setPrepareIsolation
Set the transaction isolation level that will be used for the next prepare. Used by network server to implement DB2 style isolation levels.- Specified by:
setPrepareIsolationin interfaceEngineConnection- Parameters:
level- 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.- Throws:
SQLException
-
getPrepareIsolation
public int getPrepareIsolation()Return prepare isolation- Specified by:
getPrepareIsolationin interfaceEngineConnection
-
getResultSetOrderId
final int getResultSetOrderId()Return a unique order number for a result set. A unique value is only needed if the result set is being created within procedure and thus must be using a nested connection. -
newSQLException
-
toString
Get a String representation that uniquely identifies this connection. Include the same information that is printed in the log for various trace and error messages. In Derby the "physical" connection is a LanguageConnectionContext, or LCC. The JDBC Connection is an JDBC-specific layer on top of this. Rather than create a new id here, we simply use the id of the underlying LCC. Note that this is a big aid in debugging, because much of the engine trace and log code prints the LCC id. -
createClob
Constructs an object that implements theClobinterface. The object returned initially contains no data. ThesetAsciiStream,setCharacterStreamandsetStringmethods of theClobinterface may be used to add data to theClob.- Specified by:
createClobin interfaceConnection- Returns:
- An object that implements the
Clobinterface - Throws:
SQLException- if an object that implements theClobinterface can not be constructed, this method is called on a closed connection or a database access error occurs.
-
createBlob
Constructs an object that implements theBlobinterface. The object returned initially contains no data. ThesetBinaryStreamandsetBytesmethods of theBlobinterface may be used to add data to theBlob.- Specified by:
createBlobin interfaceConnection- Returns:
- An object that implements the
Blobinterface - Throws:
SQLException- if an object that implements theBlobinterface can not be constructed, this method is called on a closed connection or a database access error occurs.
-
addLOBMapping
Add the locator and the corresponding LOB object into the HashMap- Parameters:
LOBReference- The object which contains the LOB object that that is added to the HashMap.- Returns:
- an integer that represents the locator that has been allocated to this LOB.
-
removeLOBMapping
public void removeLOBMapping(int key) Remove the key(LOCATOR) from the hash table.- Parameters:
key- an integer that represents the locator that needs to be removed from the table.
-
getLOBMapping
Get the LOB reference corresponding to the locator.- Specified by:
getLOBMappingin interfaceEngineConnection- Parameters:
key- the integer that represents the LOB locator value.- Returns:
- the LOB Object corresponding to this locator.
-
clearLOBMapping
Clear the HashMap of all entries. Called when a commit or rollback of the transaction happens.- Throws:
SQLException
-
getIncLOBKey
private int getIncLOBKey()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)- Returns:
- an integer that represents the most recent locator value.
-
addLOBReference
Adds an entry of the lob in WeakHashMap. These entries are used for cleanup during commit/rollback or close.- Parameters:
lobReference- LOB Object
-
getlobHMObj
-
cancelRunningStatement
public void cancelRunningStatement()Cancels the current running statement. -
getCurrentSchemaName
Obtain the name of the current schema. Not part of the java.sql.Connection interface, but is accessible through the EngineConnection interface, so that the NetworkServer can get at the current schema for piggy-backing- Specified by:
getCurrentSchemaNamein interfaceEngineConnection- Returns:
- the current schema name
-
addLobFile
Add a temporary lob file to the lobFiles set. This will get closed at transaction end or removed as the lob is freed.- Parameters:
lobFile- LOBFile to add
-
removeLobFile
Remove LOBFile from the lobFiles set. This will occur when the lob is freed or at transaction end if the lobFile was removed from the WeakHashMap but not finalized.- Parameters:
lobFile- LOBFile to remove.
-
isAborting
public boolean isAborting()Return true if the connection is aborting -
beginAborting
protected void beginAborting()Begin aborting the connection -
setSavepoint
Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.- Specified by:
setSavepointin interfaceConnection- Returns:
- The new Savepoint object
- Throws:
SQLException- if a database access error occurs or this Connection object is currently in auto-commit mode
-
setSavepoint
Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that represents it.- Specified by:
setSavepointin interfaceConnection- Parameters:
name- A String containing the name of the savepoint- Returns:
- The new Savepoint object
- Throws:
SQLException- if a database access error occurs or this Connection object is currently in auto-commit mode
-
commonSetSavepointCode
private Savepoint commonSetSavepointCode(String name, boolean userSuppliedSavepointName) throws SQLException 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.- Parameters:
name- A String containing the name of the savepoint. Will be null if this is an unnamed savepointuserSuppliedSavepointName- If true means it's a named user defined savepoint.- Returns:
- The new Savepoint object
- Throws:
SQLException
-
rollback
Undoes all changes made after the given Savepoint object was set. This method should be used only when auto-commit has been disabled.- Specified by:
rollbackin interfaceConnection- Parameters:
savepoint- The Savepoint object to rollback to- Throws:
SQLException- if a database access error occurs, the Savepoint object is no longer valid, or this Connection object is currently in auto-commit mode
-
releaseSavepoint
Removes the given Savepoint object from the current transaction. Any reference to the savepoint after it has been removed will cause an SQLException to be thrown- Specified by:
releaseSavepointin interfaceConnection- Parameters:
savepoint- The Savepoint object to be removed- Throws:
SQLException- if a database access error occurs or the given Savepoint object is not a valid savepoint in the current transaction
-
verifySavepointCommandIsAllowed
- Throws:
SQLException
-
verifySavepointArg
- Throws:
SQLException
-
getSchema
Get the name of the current schema.- Specified by:
getSchemain interfaceConnection- Specified by:
getSchemain interfaceEngineConnection- Throws:
SQLException
-
setSchema
Set the default schema for the Connection.- Specified by:
setSchemain interfaceConnection- Specified by:
setSchemain interfaceEngineConnection- Throws:
SQLException
-
checkConflictingCryptoAttributes
Examines the boot properties looking for conflicting cryptographic options and commands.- Parameters:
p- boot properties (for instance URL connection attributes)- Throws:
SQLException- if conflicting crypto attributes are detected
-
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createNClob
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
createStruct
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
isValid
Checks if the connection has not been closed and is still valid. The validity is checked by checking that the connection is not closed.- Specified by:
isValidin interfaceConnection- Parameters:
timeout- This 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.- Returns:
- true if the connection is valid, false otherwise
- Throws:
SQLException- if the parameter value is illegal or if a database error has occurred
-
setClientInfo
setClientInfowill always throw aSQLClientInfoExceptionsince Derby does not support any properties.- Specified by:
setClientInfoin interfaceConnection- Parameters:
name- a property keyStringvalue- a property valueString- Throws:
SQLClientInfoException- unless both name and value are null
-
setClientInfo
setClientInfowill throw aSQLClientInfoExceptionunless thepropertiesparameter is empty, since Derby does not support any properties. All the property keys in thepropertiesparameter are added to failedProperties of the exception thrown, with REASON_UNKNOWN_PROPERTY as the value.- Specified by:
setClientInfoin interfaceConnection- Parameters:
properties- aPropertiesobject with the properties to set- Throws:
SQLClientInfoException- unless properties parameter is null or empty
-
getClientInfo
getClientInfoalways returns anull Stringsince Derby doesn't support ClientInfoProperties.- Specified by:
getClientInfoin interfaceConnection- Parameters:
name- aStringvalue- Returns:
- a
null Stringvalue - Throws:
SQLException- if the connection is closed.
-
getClientInfo
getClientInfoalways returns an emptyPropertiesobject since Derby doesn't support ClientInfoProperties.- Specified by:
getClientInfoin interfaceConnection- Returns:
- an empty
Propertiesobject - Throws:
SQLException- if the connection is closed.
-
getTypeMap
Returns the type map for this connection.- Specified by:
getTypeMapin interfaceConnection- Returns:
- type map for this connection
- Throws:
SQLException- if a database access error occurs
-
isWrapperFor
Returns false unlessinterfacesis implemented- Specified by:
isWrapperForin interfaceWrapper- Parameters:
interfaces- a Class defining an interface.- Returns:
- true if this implements the interface or directly or indirectly wraps an object that does.
- Throws:
SQLException- if an error occurs while determining whether this is a wrapper for an object with the given interface.
-
unwrap
Returnsthisif this class implements the interface- Specified by:
unwrapin interfaceWrapper- Parameters:
interfaces- a Class defining an interface- Returns:
- an object that implements the interface
- Throws:
SQLException- if no object is found that implements the interface
-
abort
/////////////////////////////////////////////////////////////////- Specified by:
abortin interfaceConnection- Specified by:
abortin interfaceEngineConnection- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeoutin interfaceConnection- Specified by:
getNetworkTimeoutin interfaceEngineConnection- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Specified by:
setNetworkTimeoutin interfaceEngineConnection- Throws:
SQLException
-
getMonitor
Privileged Monitor lookup. Must be package private so that user code can't call this entry point. -
findService
-
startPersistentService
private static boolean startPersistentService(String serviceName, Properties properties) throws StandardException Privileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
createPersistentService
private static Object createPersistentService(String factoryInterface, String serviceName, Properties properties) throws StandardException Privileged startup. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
removePersistentService
Privileged shutdown. Must be private so that user code can't call this entry point.- Throws:
StandardException
-
privilegedGetLCC
Private, privileged lookup of the lcc..
-