java.lang.AutoCloseable, java.sql.Connection, java.sql.Wrapper, EngineConnectionBrokeredConnection42public class BrokeredConnection extends java.lang.Object implements EngineConnection
| Modifier and Type | Field | Description |
|---|---|---|
private java.lang.String |
connString |
|
(package private) BrokeredConnectionControl |
control |
|
protected boolean |
isClosed |
|
private boolean |
stateAutoCommit |
|
(package private) int |
stateHoldability |
|
private int |
stateIsolationLevel |
Maintain state as seen by this Connection handle, not the state
of the underlying Connection it is attached to.
|
private boolean |
stateReadOnly |
| Constructor | Description |
|---|---|
BrokeredConnection(BrokeredConnectionControl control) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
abort(java.util.concurrent.Executor executor) |
|
void |
addWarning(java.sql.SQLWarning w) |
Add a SQLWarning to this Connection object.
|
void |
clearWarnings() |
|
void |
close() |
|
void |
commit() |
|
java.sql.Array |
createArrayOf(java.lang.String typeName,
java.lang.Object[] elements) |
|
java.sql.Blob |
createBlob() |
Constructs an object that implements the
Blob interface. |
java.sql.Clob |
createClob() |
Constructs an object that implements the
Clob interface. |
java.sql.NClob |
createNClob() |
|
java.sql.SQLXML |
createSQLXML() |
|
java.sql.Statement |
createStatement() |
|
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency) |
|
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
|
java.sql.Struct |
createStruct(java.lang.String typeName,
java.lang.Object[] attributes) |
|
boolean |
getAutoCommit() |
|
java.lang.String |
getCatalog() |
|
java.util.Properties |
getClientInfo() |
getClientInfo forwards to the real connection. |
java.lang.String |
getClientInfo(java.lang.String name) |
getClientInfo forwards to the real connection. |
java.lang.String |
getCurrentSchemaName() |
Obtain the name of the current schema.
|
int |
getHoldability() |
Get the holdability for statements created by this connection
when holdability is not passed in.
|
void |
getIsolationUptoDate() |
Isolation level state in BrokeredConnection can get out of sync
if the isolation is set using SQL rather than JDBC.
|
java.lang.Object |
getLOBMapping(int key) |
Get the LOB reference corresponding to the locator.
|
java.sql.DatabaseMetaData |
getMetaData() |
|
int |
getNetworkTimeout() |
|
int |
getPrepareIsolation() |
get the isolation level that is currently being used to prepare
statements (used for network server)
|
(package private) EngineConnection |
getRealConnection() |
A little indirection for getting the real connection.
|
java.lang.String |
getSchema() |
Get the name of the current schema.
|
int |
getTransactionIsolation() |
|
java.util.Map<java.lang.String,java.lang.Class<?>> |
getTypeMap() |
|
java.sql.SQLWarning |
getWarnings() |
|
boolean |
isClosed() |
|
boolean |
isInGlobalTransaction() |
Is this a global transaction
|
boolean |
isReadOnly() |
|
boolean |
isValid(int timeout) |
Checks if the connection has not been closed and is still valid.
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
Returns false unless
iface is implemented. |
java.lang.String |
nativeSQL(java.lang.String sql) |
|
BrokeredStatement |
newBrokeredStatement(BrokeredStatementControl statementControl) |
|
BrokeredCallableStatement |
newBrokeredStatement(BrokeredStatementControl statementControl,
java.lang.String sql) |
|
BrokeredPreparedStatement |
newBrokeredStatement(BrokeredStatementControl statementControl,
java.lang.String sql,
java.lang.Object generatedKeys) |
|
(package private) java.sql.SQLException |
noCurrentConnection() |
Generate an exception reporting that there is no current connection.
|
(package private) void |
notifyException(java.sql.SQLException sqle) |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql) |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
|
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int autoGeneratedKeys) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int[] columnIndexes) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency) |
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
Prepare statement with explicit holdability.
|
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
java.lang.String[] columnNames) |
|
void |
releaseSavepoint(java.sql.Savepoint savepoint) |
|
void |
resetFromPool() |
Resets the connection before it is returned from a PooledConnection
to a new application request (wrapped by a BrokeredConnection).
|
void |
rollback() |
|
void |
rollback(java.sql.Savepoint savepoint) |
|
void |
setAutoCommit(boolean autoCommit) |
|
void |
setCatalog(java.lang.String catalog) |
|
void |
setClientInfo(java.lang.String name,
java.lang.String value) |
setClientInfo forwards to the real connection. |
void |
setClientInfo(java.util.Properties properties) |
setClientInfo forwards to the real connection. |
void |
setDrdaID(java.lang.String drdaID) |
set the DrdaId for this connection.
|
void |
setHoldability(int holdability) |
|
void |
setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds) |
|
void |
setPrepareIsolation(int level) |
Set the internal isolation level to use for preparing statements.
|
void |
setReadOnly(boolean readOnly) |
|
java.sql.Savepoint |
setSavepoint() |
|
java.sql.Savepoint |
setSavepoint(java.lang.String name) |
|
void |
setSchema(java.lang.String schemaName) |
Set the default schema for the Connection.
|
void |
setState(boolean complete) |
Set the state of the underlying connection according to the
state of this connection's view of state.
|
void |
setTransactionIsolation(int level) |
|
void |
setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map) |
|
(package private) int |
statementHoldabilityCheck(int resultSetHoldability) |
Check the result set holdability when creating a statement
object.
|
void |
syncState() |
Sync up the state of the underlying connection
with the state of this new handle.
|
java.lang.String |
toString() |
Get the string representation for this connection.
|
<T> T |
unwrap(java.lang.Class<T> iface) |
Returns
this if this class implements the interface. |
int stateHoldability
final BrokeredConnectionControl control
protected boolean isClosed
private java.lang.String connString
private int stateIsolationLevel
private boolean stateReadOnly
private boolean stateAutoCommit
public BrokeredConnection(BrokeredConnectionControl control) throws java.sql.SQLException
java.sql.SQLExceptionpublic final void setAutoCommit(boolean autoCommit)
throws java.sql.SQLException
setAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionpublic final boolean getAutoCommit()
throws java.sql.SQLException
getAutoCommit in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Statement createStatement()
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.PreparedStatement prepareStatement(java.lang.String sql)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.CallableStatement prepareCall(java.lang.String sql)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.lang.String nativeSQL(java.lang.String sql)
throws java.sql.SQLException
nativeSQL in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void commit()
throws java.sql.SQLException
commit in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void rollback()
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void close()
throws java.sql.SQLException
close in interface java.lang.AutoCloseableclose in interface java.sql.Connectionjava.sql.SQLExceptionpublic final boolean isClosed()
throws java.sql.SQLException
isClosed in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.SQLWarning getWarnings()
throws java.sql.SQLException
getWarnings in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void clearWarnings()
throws java.sql.SQLException
clearWarnings in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.DatabaseMetaData getMetaData()
throws java.sql.SQLException
getMetaData in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void setReadOnly(boolean readOnly)
throws java.sql.SQLException
setReadOnly in interface java.sql.Connectionjava.sql.SQLExceptionpublic final boolean isReadOnly()
throws java.sql.SQLException
isReadOnly in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void setCatalog(java.lang.String catalog)
throws java.sql.SQLException
setCatalog in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.lang.String getCatalog()
throws java.sql.SQLException
getCatalog in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void setTransactionIsolation(int level)
throws java.sql.SQLException
setTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionpublic final int getTransactionIsolation()
throws java.sql.SQLException
getTransactionIsolation in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic java.util.Map<java.lang.String,java.lang.Class<?>> getTypeMap()
throws java.sql.SQLException
getTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void setTypeMap(java.util.Map<java.lang.String,java.lang.Class<?>> map)
throws java.sql.SQLException
setTypeMap in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Statement createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
createStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.CallableStatement prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareCall in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Savepoint setSavepoint()
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Savepoint setSavepoint(java.lang.String name)
throws java.sql.SQLException
setSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void rollback(java.sql.Savepoint savepoint)
throws java.sql.SQLException
rollback in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void releaseSavepoint(java.sql.Savepoint savepoint)
throws java.sql.SQLException
releaseSavepoint in interface java.sql.Connectionjava.sql.SQLExceptionpublic final void setHoldability(int holdability)
throws java.sql.SQLException
setHoldability in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int autoGeneratedKeys)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int[] columnIndexes)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.PreparedStatement prepareStatement(java.lang.String sql,
java.lang.String[] columnNames)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionfinal java.sql.SQLException noCurrentConnection()
final EngineConnection getRealConnection() throws java.sql.SQLException
java.sql.SQLExceptionfinal void notifyException(java.sql.SQLException sqle)
public void syncState()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void getIsolationUptoDate()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void setState(boolean complete)
throws java.sql.SQLException
complete - If true set the complete state of the underlying
Connection, otherwise set only the Connection related state (ie.
the non-transaction specific state).java.sql.SQLExceptionpublic final BrokeredStatement newBrokeredStatement(BrokeredStatementControl statementControl) throws java.sql.SQLException
java.sql.SQLExceptionpublic BrokeredPreparedStatement newBrokeredStatement(BrokeredStatementControl statementControl, java.lang.String sql, java.lang.Object generatedKeys) throws java.sql.SQLException
java.sql.SQLExceptionpublic BrokeredCallableStatement newBrokeredStatement(BrokeredStatementControl statementControl, java.lang.String sql) throws java.sql.SQLException
java.sql.SQLExceptionpublic final void setDrdaID(java.lang.String drdaID)
setDrdaID in interface EngineConnectiondrdaID - drdaID to be used for this connectionpublic boolean isInGlobalTransaction()
EngineConnectionisInGlobalTransaction in interface EngineConnectionEngineConnection.isInGlobalTransaction()public final void setPrepareIsolation(int level)
throws java.sql.SQLException
setPrepareIsolation in interface EngineConnectionlevel - - internal isolation leveljava.sql.SQLException - See EmbedConnection#setPrepareIsolationpublic final int getPrepareIsolation()
throws java.sql.SQLException
getPrepareIsolation in interface EngineConnectionjava.sql.SQLExceptionpublic final void addWarning(java.sql.SQLWarning w)
throws java.sql.SQLException
addWarning in interface EngineConnectionw - Warning to be added, will be chained to any
existing warnings.java.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic final java.sql.PreparedStatement prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability)
throws java.sql.SQLException
prepareStatement in interface java.sql.Connectionjava.sql.SQLExceptionpublic final int getHoldability()
throws java.sql.SQLException
getHoldability in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Array createArrayOf(java.lang.String typeName,
java.lang.Object[] elements)
throws java.sql.SQLException
createArrayOf in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Blob createBlob()
throws java.sql.SQLException
Blob interface. The
object returned initially contains no data. The setBinaryStream
and setBytes methods of the Blob interface may be used to
add data to the Blob.createBlob in interface java.sql.ConnectionBlob interfacejava.sql.SQLException - if an object that implements the Blob
interface can not be constructed, this method is called on a closed
connection or a database access error occurs.public final java.sql.Clob createClob()
throws java.sql.SQLException
Clob interface. The
object returned initially contains no data. The setAsciiStream,
setCharacterStream and setString methods of the
Clob interface may be used to add data to the Clob.createClob in interface java.sql.ConnectionClob interfacejava.sql.SQLException - if an object that implements the Clob
interface can not be constructed, this method is called on a closed
connection or a database access error occurs.public final java.sql.NClob createNClob()
throws java.sql.SQLException
createNClob in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.SQLXML createSQLXML()
throws java.sql.SQLException
createSQLXML in interface java.sql.Connectionjava.sql.SQLExceptionpublic final java.sql.Struct createStruct(java.lang.String typeName,
java.lang.Object[] attributes)
throws java.sql.SQLException
createStruct in interface java.sql.Connectionjava.sql.SQLExceptionpublic final boolean isValid(int timeout)
throws java.sql.SQLException
isValid in interface java.sql.Connectiontimeout - The time in seconds to wait for the database operation
used to validate the connection to complete. If the timeout period
expires before the operation completes, this method returns false. A
value of 0 indicates a timeout is not applied to the database operation.java.sql.SQLException - if the call on the physical connection throws an
exception.public final void setClientInfo(java.lang.String name,
java.lang.String value)
throws java.sql.SQLClientInfoException
setClientInfo forwards to the real connection.setClientInfo in interface java.sql.Connectionname - the property key Stringvalue - the property value Stringjava.sql.SQLClientInfoException - if the property is not supported or the
real connection could not be obtained.public final void setClientInfo(java.util.Properties properties)
throws java.sql.SQLClientInfoException
setClientInfo forwards to the real connection. If the call to
getRealConnection fails the resulting SQLException is
wrapped in a SQLClientInfoException to satisfy the specified
signature.setClientInfo in interface java.sql.Connectionproperties - a Properties object with the properties to set.java.sql.SQLClientInfoException - if the properties are not supported or
the real connection could not be obtained.public final java.lang.String getClientInfo(java.lang.String name)
throws java.sql.SQLException
getClientInfo forwards to the real connection.getClientInfo in interface java.sql.Connectionname - a String that is the property key to get.String that is returned from the real connection.java.sql.SQLException - if a database access error occurs.public final java.util.Properties getClientInfo()
throws java.sql.SQLException
getClientInfo forwards to the real connection.getClientInfo in interface java.sql.ConnectionProperties object from the real connection.java.sql.SQLException - if a database access error occurs.public final boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
iface is implemented.isWrapperFor in interface java.sql.Wrapperiface - a Class defining an interface.java.sql.SQLException - if an error occurs while determining
whether this is a wrapper for an object with the given interface.public final <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
this if this class implements the interface.unwrap in interface java.sql.Wrapperiface - a Class defining an interfacejava.sql.SQLException - if no object if found that implements the
interfacefinal int statementHoldabilityCheck(int resultSetHoldability)
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.lang.Object getLOBMapping(int key)
throws java.sql.SQLException
getLOBMapping in interface EngineConnectionkey - the integer that represents the LOB locator value.java.sql.SQLExceptionpublic java.lang.String getCurrentSchemaName()
throws java.sql.SQLException
getCurrentSchemaName in interface EngineConnectionjava.sql.SQLExceptionpublic void resetFromPool()
throws java.sql.SQLException
EngineConnectionNote that resetting the transaction isolation level is not performed as part of this method. Temporary tables, IDENTITY_VAL_LOCAL and current schema are reset.
resetFromPool in interface EngineConnectionjava.sql.SQLExceptionEngineConnectionpublic java.lang.String getSchema()
throws java.sql.SQLException
getSchema in interface java.sql.ConnectiongetSchema in interface EngineConnectionjava.sql.SQLExceptionpublic void setSchema(java.lang.String schemaName)
throws java.sql.SQLException
setSchema in interface java.sql.ConnectionsetSchema in interface EngineConnectionjava.sql.SQLExceptionpublic void abort(java.util.concurrent.Executor executor)
throws java.sql.SQLException
abort in interface java.sql.Connectionabort in interface EngineConnectionjava.sql.SQLExceptionpublic int getNetworkTimeout()
throws java.sql.SQLException
getNetworkTimeout in interface java.sql.ConnectiongetNetworkTimeout in interface EngineConnectionjava.sql.SQLExceptionpublic void setNetworkTimeout(java.util.concurrent.Executor executor,
int milliseconds)
throws java.sql.SQLException
setNetworkTimeout in interface java.sql.ConnectionsetNetworkTimeout in interface EngineConnectionjava.sql.SQLExceptionApache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.