javax.sql.PooledConnection, BrokeredConnectionControlEmbedXAConnectionclass EmbedPooledConnection extends java.lang.Object implements javax.sql.PooledConnection, BrokeredConnectionControl
This is Derby's implementation of a PooledConnection for use in the following environments:
| Modifier and Type | Field | Description |
|---|---|---|
private java.lang.String |
connString |
the connection string
|
(package private) BrokeredConnection |
currentConnectionHandle |
|
(package private) BasicEmbeddedDataSource40 |
dataSource |
|
(package private) int |
defaultIsolationLevel |
|
private boolean |
defaultReadOnly |
|
private int |
eventIterators |
The number of iterators going through the list of connection event
listeners at the current time.
|
private java.util.ArrayList<javax.sql.ConnectionEventListener> |
eventListener |
The list of
ConnectionEventListeners. |
protected boolean |
isActive |
|
private java.lang.String |
password |
|
(package private) EmbedConnection |
realConnection |
|
private boolean |
requestPassword |
True if the password was passed in on the connection request, false if it came from the data source property.
|
private java.util.concurrent.CopyOnWriteArrayList<javax.sql.StatementEventListener> |
statementEventListeners |
List of statement event listeners.
|
private java.lang.String |
username |
| Constructor | Description |
|---|---|
EmbedPooledConnection(BasicEmbeddedDataSource40 ds,
java.lang.String u,
java.lang.String p,
boolean requestPassword) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addConnectionEventListener(javax.sql.ConnectionEventListener listener) |
Add an event listener.
|
void |
addStatementEventListener(javax.sql.StatementEventListener listener) |
Registers a
StatementEventListener with this
PooledConnection object. |
(package private) void |
checkActive() |
|
void |
checkAutoCommit(boolean autoCommit) |
Allow control over setting auto commit mode.
|
void |
checkClose() |
Check if the brokered connection can be closed.
|
void |
checkCommit() |
Allow control over calling commit.
|
int |
checkHoldCursors(int holdability,
boolean downgrade) |
Are held cursors allowed.
|
void |
checkRollback() |
Allow control over calling rollback.
|
void |
checkSavepoint() |
Allow control over creating a Savepoint (JDBC 3.0)
|
void |
close() |
Close the Pooled connection.
|
private void |
closeCurrentConnectionHandle() |
In this case the Listeners are *not* notified.
|
boolean |
closingConnection() |
Close called on BrokeredConnection.
|
private void |
fireConnectionEventListeners(java.sql.SQLException exception) |
Fire all the
ConnectionEventListeners registered. |
java.sql.Connection |
getConnection() |
Create an object handle for a database connection.
|
LanguageConnectionContext |
getLanguageConnection() |
|
private static LanguageConnectionContext |
getLanguageConnectionContext(EmbedConnection conn) |
Gets the LanguageConnectionContext for this connection.
|
(package private) java.sql.Connection |
getNewCurrentConnectionHandle() |
|
(package private) java.lang.String |
getPassword() |
|
EngineConnection |
getRealConnection() |
Return the real JDBC connection for the brokered connection.
|
(package private) java.lang.String |
getUsername() |
|
boolean |
isActive() |
getter function for isActive
|
boolean |
isInGlobalTransaction() |
Is this a global transaction
|
boolean |
isIsolationLevelSetUsingSQLorJDBC() |
Returns true if isolation level has been set using either JDBC api or SQL
|
void |
notifyError(java.sql.SQLException exception) |
|
void |
notifyException(java.sql.SQLException sqle) |
Notify the control class that a SQLException was thrown
during a call on one of the brokered connection's methods.
|
void |
onStatementClose(java.sql.PreparedStatement statement) |
Raise the statementClosed event for all the listeners when the
corresponding events occurs
|
void |
onStatementErrorOccurred(java.sql.PreparedStatement statement,
java.sql.SQLException sqle) |
Raise the statementErrorOccurred event for all the listeners when the
corresponding events occurs
|
(package private) void |
openRealConnection() |
|
void |
removeConnectionEventListener(javax.sql.ConnectionEventListener listener) |
Remove an event listener.
|
void |
removeStatementEventListener(javax.sql.StatementEventListener listener) |
Removes the specified
StatementEventListener from the list of
components that will be notified when the driver detects that a
PreparedStatement has been closed or is invalid. |
void |
resetIsolationLevelFlag() |
Reset the isolation level flag used to keep state in
BrokeredConnection.
|
(package private) void |
resetRealConnection() |
|
java.lang.String |
toString() |
Get the string representation of this pooled connection.
|
java.sql.CallableStatement |
wrapStatement(java.sql.CallableStatement cs,
java.lang.String sql) |
Call the setBrokeredConnectionControl method inside the
EmbedCallableStatement class to set the BrokeredConnectionControl
variable to this instance of EmbedPooledConnection
This will then be used to call the onStatementErrorOccurred
and onStatementClose events when the corresponding events
occur on the CallableStatement
|
java.sql.PreparedStatement |
wrapStatement(java.sql.PreparedStatement ps,
java.lang.String sql,
java.lang.Object generatedKeys) |
Call the setBrokeredConnectionControl method inside the
EmbedPreparedStatement class to set the BrokeredConnectionControl
variable to this instance of EmbedPooledConnection
This will then be used to call the onStatementErrorOccurred
and onStatementClose events when the corresponding events
occur on the PreparedStatement
|
java.sql.Statement |
wrapStatement(java.sql.Statement s) |
No need to wrap statements for PooledConnections.
|
private java.lang.String connString
private java.util.ArrayList<javax.sql.ConnectionEventListener> eventListener
ConnectionEventListeners. It is initially
null and will be initialized lazily when the first listener is added.private final java.util.concurrent.CopyOnWriteArrayList<javax.sql.StatementEventListener> statementEventListeners
private int eventIterators
EmbedConnection realConnection
int defaultIsolationLevel
private boolean defaultReadOnly
BrokeredConnection currentConnectionHandle
final BasicEmbeddedDataSource40 dataSource
private final java.lang.String username
private final java.lang.String password
private final boolean requestPassword
protected boolean isActive
EmbedPooledConnection(BasicEmbeddedDataSource40 ds, java.lang.String u, java.lang.String p, boolean requestPassword) throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isActive()
java.lang.String getUsername()
java.lang.String getPassword()
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.PooledConnectionjava.sql.SQLException - - if a database-access error occurs.final void openRealConnection()
throws java.sql.SQLException
java.sql.SQLExceptionfinal java.sql.Connection getNewCurrentConnectionHandle()
throws java.sql.SQLException
java.sql.SQLExceptionprivate void closeCurrentConnectionHandle()
throws java.sql.SQLException
java.sql.SQLExceptionvoid resetRealConnection()
throws java.sql.SQLException
java.sql.SQLExceptionpublic void close()
throws java.sql.SQLException
close in interface javax.sql.PooledConnectionjava.sql.SQLException - - if a database-access error occurs.public final void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
addConnectionEventListener in interface javax.sql.PooledConnectionpublic final void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
removeConnectionEventListener in interface javax.sql.PooledConnectionpublic EngineConnection getRealConnection() throws java.sql.SQLException
BrokeredConnectionControlgetRealConnection in interface BrokeredConnectionControljava.sql.SQLExceptionpublic LanguageConnectionContext getLanguageConnection() throws java.sql.SQLException
java.sql.SQLExceptionpublic void notifyError(java.sql.SQLException exception)
private void fireConnectionEventListeners(java.sql.SQLException exception)
ConnectionEventListeners registered. Callers must
synchronize on this to prevent others from modifying the list of
listeners.exception - the exception that caused the event, or null if
it is a close eventfinal void checkActive()
throws java.sql.SQLException
java.sql.SQLExceptionpublic boolean isIsolationLevelSetUsingSQLorJDBC()
throws java.sql.SQLException
isIsolationLevelSetUsingSQLorJDBC in interface BrokeredConnectionControljava.sql.SQLExceptionpublic void resetIsolationLevelFlag()
throws java.sql.SQLException
resetIsolationLevelFlag in interface BrokeredConnectionControljava.sql.SQLExceptionpublic boolean isInGlobalTransaction()
BrokeredConnectionControlisInGlobalTransaction in interface BrokeredConnectionControlBrokeredConnectionControl.isInGlobalTransaction()public void notifyException(java.sql.SQLException sqle)
notifyException in interface BrokeredConnectionControlpublic void checkAutoCommit(boolean autoCommit)
throws java.sql.SQLException
checkAutoCommit in interface BrokeredConnectionControljava.sql.SQLExceptionpublic int checkHoldCursors(int holdability,
boolean downgrade)
throws java.sql.SQLException
checkHoldCursors in interface BrokeredConnectionControldowngrade - true to downgrade the holdability,
false to throw an exception.java.sql.SQLExceptionpublic void checkSavepoint()
throws java.sql.SQLException
checkSavepoint in interface BrokeredConnectionControljava.sql.SQLExceptionpublic void checkRollback()
throws java.sql.SQLException
checkRollback in interface BrokeredConnectionControljava.sql.SQLExceptionpublic void checkCommit()
throws java.sql.SQLException
checkCommit in interface BrokeredConnectionControljava.sql.SQLExceptionpublic void checkClose()
throws java.sql.SQLException
BrokeredConnectionControlcheckClose in interface BrokeredConnectionControljava.sql.SQLException - if it is not allowed to call close on the brokered
connectionBrokeredConnectionControl.checkClose()public boolean closingConnection()
throws java.sql.SQLException
closingConnection in interface BrokeredConnectionControljava.sql.SQLExceptionpublic java.sql.Statement wrapStatement(java.sql.Statement s)
throws java.sql.SQLException
wrapStatement in interface BrokeredConnectionControljava.sql.SQLExceptionpublic java.sql.PreparedStatement wrapStatement(java.sql.PreparedStatement ps,
java.lang.String sql,
java.lang.Object generatedKeys)
throws java.sql.SQLException
wrapStatement in interface BrokeredConnectionControlps - PreparedStatment to be wrappedsql - StringgeneratedKeys - Objectjava.sql.SQLExceptionpublic java.sql.CallableStatement wrapStatement(java.sql.CallableStatement cs,
java.lang.String sql)
throws java.sql.SQLException
wrapStatement in interface BrokeredConnectionControlcs - CallableStatment to be wrappedsql - Stringjava.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void onStatementClose(java.sql.PreparedStatement statement)
onStatementClose in interface BrokeredConnectionControlstatement - the PreparedStatement that was closedpublic void onStatementErrorOccurred(java.sql.PreparedStatement statement,
java.sql.SQLException sqle)
onStatementErrorOccurred in interface BrokeredConnectionControlstatement - the PreparedStatement in which the
error occurredsqle - the SQLException that was thrownpublic void removeStatementEventListener(javax.sql.StatementEventListener listener)
StatementEventListener from the list of
components that will be notified when the driver detects that a
PreparedStatement has been closed or is invalid.removeStatementEventListener in interface javax.sql.PooledConnectionlistener - the component which implements the
StatementEventListener interface that was previously registered
with this PooledConnection objectpublic void addStatementEventListener(javax.sql.StatementEventListener listener)
StatementEventListener with this
PooledConnection object. Components that wish to be notified when
PreparedStatements created by the connection are closed or are
detected to be invalid may use this method to register a
StatementEventListener with this PooledConnection object.addStatementEventListener in interface javax.sql.PooledConnectionlistener - an component which implements the
StatementEventListener interface that is to be registered with
this PooledConnection objectprivate static LanguageConnectionContext getLanguageConnectionContext(EmbedConnection conn)
Apache Derby V10.14 Internals - Copyright © 2004,2018 The Apache Software Foundation. All Rights Reserved.