This is Derby's implementation of a PooledConnection for use in the following environments:
| Modifier and Type | Field and Description |
|---|---|
| private String | connString
the connection string |
| pack-priv BrokeredConnection | |
| pack-priv final EmbeddedDataSourceInterface | |
| pack-priv int | |
| private boolean | |
| private int | eventIterators
The number of iterators going through the list of connection event listeners at the current time. |
| private ArrayList | eventListener
The list of |
| protected boolean | |
| private final String | |
| pack-priv EmbedConnection | |
| private final boolean | requestPassword
True if the password was passed in on the connection request, false if it came from the data source property. |
| private final CopyOnWriteArrayList | statementEventListeners
List of statement event listeners. |
| private final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final synchronized void | addConnectionEventListener(ConnectionEventListener
a component, usually the connection pool manager,
that has implemented the
listener)ConnectionEventListener interface and wants to be
notified when the connection is closed or has an errorImplements javax. Add an event listener. |
| public void | addStatementEventListener(StatementEventListener
an component which implements the
listener)StatementEventListener interface that is to be registered with
this PooledConnection objectImplements javax. Registers a |
| pack-priv final void | |
| public void | checkAutoCommit(boolean
New auto commit setting autoCommit)Implements org. Allow control over setting auto commit mode. |
| public void | checkClose()
Implements org. Check if the brokered connection can be closed. |
| public void | checkCommit()
Implements org. Allow control over calling commit. |
| public int | checkHoldCursors(int
Current holdability holdability, boolean true to downgrade the holdability, false to throw an exception. downgrade)Implements org. Are held cursors allowed. |
| public void | checkRollback()
Implements org. Allow control over calling rollback. |
| public void | checkSavepoint()
Implements org. Allow control over creating a Savepoint (JDBC 3.0) |
| public synchronized void | |
| private void | |
| public synchronized boolean | closingConnection()
Implements org. Close called on BrokeredConnection. |
| private void | fireConnectionEventListeners(SQLException
the exception that caused the event, or exception)null if
it is a close eventFire all the |
| public synchronized Connection | Returns: a Connection objectImplements javax. Create an object handle for a database connection. |
| public synchronized LanguageConnectionContext | |
| private static LanguageConnectionContext | getLanguageConnectionContext(final EmbedConnection conn)
Gets the LanguageConnectionContext for this connection. |
| pack-priv final Connection | |
| pack-priv String | |
| public synchronized EngineConnection | getRealConnection()
Implements org. Return the real JDBC connection for the brokered connection. |
| pack-priv String | |
| public boolean | |
| public boolean | isInGlobalTransaction()
Implements org. Is this a global transaction |
| public boolean | isIsolationLevelSetUsingSQLorJDBC()
Implements org. Returns true if isolation level has been set using either JDBC api or SQL |
| public synchronized void | |
| public void | notifyException(SQLException
A sql exception sqle)Implements org. Notify the control class that a SQLException was thrown during a call on one of the brokered connection's methods. |
| public void | onStatementClose(PreparedStatement
the statement)PreparedStatement that was closedImplements org. Raise the statementClosed event for all the listeners when the corresponding events occurs |
| public void | onStatementErrorOccurred(PreparedStatement
the statement, SQLException PreparedStatement in which the
error occurredthe sqle)SQLException that was thrownImplements org. Raise the statementErrorOccurred event for all the listeners when the corresponding events occurs |
| pack-priv final void | |
| public final synchronized void | removeConnectionEventListener(ConnectionEventListener
a component, usually the connection pool manager,
that has implemented the
listener)ConnectionEventListener interface and
been registered with this PooledConnection object as
a listenerImplements javax. Remove an event listener. |
| public void | removeStatementEventListener(StatementEventListener
the component which implements the
listener)StatementEventListener interface that was previously registered
with this PooledConnection objectImplements javax. Removes the specified |
| public void | resetIsolationLevelFlag()
Implements org. Reset the isolation level flag used to keep state in BrokeredConnection. |
| pack-priv void | |
| public String | Returns: a string representation of the uniquie id for this pooled connection.Overrides java. Get the string representation of this pooled connection. |
| public Statement | wrapStatement(Statement
The original statement s)Implements org. No need to wrap statements for PooledConnections. |
| public PreparedStatement | Returns: returns the wrapped PreparedStatementPreparedStatment to be wrapped ps, String String sql, Object Object generatedKeys)Implements org. 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 |
| public CallableStatement | Returns: returns the wrapped CallableStatementCallableStatment to be wrapped cs, String String sql)Implements org. 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 |
| connString | back to summary |
|---|---|
| private String connString the connection string | |
| currentConnectionHandle | back to summary |
|---|---|
| pack-priv BrokeredConnection currentConnectionHandle | |
| dataSource | back to summary |
|---|---|
| pack-priv final EmbeddedDataSourceInterface dataSource | |
| defaultIsolationLevel | back to summary |
|---|---|
| pack-priv int defaultIsolationLevel | |
| defaultReadOnly | back to summary |
|---|---|
| private boolean defaultReadOnly | |
| eventIterators | back to summary |
|---|---|
| private int eventIterators The number of iterators going through the list of connection event listeners at the current time. Only one thread may be iterating over the list at any time (because of synchronization), but a single thread may have multiple iterators if for instance an event listener performs database calls that trigger a new event. | |
| eventListener | back to summary |
|---|---|
| private ArrayList<ConnectionEventListener> eventListener The list of | |
| isActive | back to summary |
|---|---|
| protected boolean isActive | |
| password | back to summary |
|---|---|
| private final String password | |
| realConnection | back to summary |
|---|---|
| pack-priv EmbedConnection realConnection | |
| requestPassword | back to summary |
|---|---|
| private final boolean requestPassword True if the password was passed in on the connection request, false if it came from the data source property. | |
| statementEventListeners | back to summary |
|---|---|
| private final CopyOnWriteArrayList<StatementEventListener> statementEventListeners List of statement event listeners. The list is copied on each write, ensuring that it can be safely iterated over even if other threads or the listeners fired in the same thread add or remove listeners. | |
| username | back to summary |
|---|---|
| private final String username | |
| EmbedPooledConnection | back to summary |
|---|---|
| public EmbedPooledConnection(EmbeddedDataSourceInterface ds, String u, String p, boolean requestPassword) throws SQLException | |
| addConnectionEventListener | back to summary |
|---|---|
| public final synchronized void addConnectionEventListener(ConnectionEventListener listener) Implements javax. Add an event listener.
| |
| addStatementEventListener | back to summary |
|---|---|
| public void addStatementEventListener(StatementEventListener listener) Implements javax. Registers a
| |
| checkActive | back to summary |
|---|---|
| pack-priv final void checkActive() throws SQLException | |
| checkAutoCommit | back to summary |
|---|---|
| public void checkAutoCommit(boolean autoCommit) throws SQLException Implements org. Allow control over setting auto commit mode.
| |
| checkClose | back to summary |
|---|---|
| public void checkClose() throws SQLException Implements org. Doc from org. Check if the brokered connection can be closed.
| |
| checkCommit | back to summary |
|---|---|
| public void checkCommit() throws SQLException Implements org. Allow control over calling commit.
| |
| checkHoldCursors | back to summary |
|---|---|
| public int checkHoldCursors(int holdability, boolean downgrade) throws SQLException Implements org. Are held cursors allowed.
| |
| checkRollback | back to summary |
|---|---|
| public void checkRollback() throws SQLException Implements org. Allow control over calling rollback.
| |
| checkSavepoint | back to summary |
|---|---|
| public void checkSavepoint() throws SQLException Implements org. Allow control over creating a Savepoint (JDBC 3.0)
| |
| close | back to summary |
|---|---|
| public synchronized void close() throws SQLException Implements javax. Close the Pooled connection.
| |
| closeCurrentConnectionHandle | back to summary |
|---|---|
| private void closeCurrentConnectionHandle() throws SQLException In this case the Listeners are *not* notified. JDBC 3.0 spec section 11.4 | |
| closingConnection | back to summary |
|---|---|
| public synchronized boolean closingConnection() throws SQLException Implements org. Close called on BrokeredConnection. If this call returns true then getRealConnection().close() will be called. Notify listners that connection is closed. Don't close the underlying real connection as it is pooled.
| |
| fireConnectionEventListeners | back to summary |
|---|---|
| private void fireConnectionEventListeners(SQLException exception) Fire all the
| |
| getConnection | back to summary |
|---|---|
| public synchronized Connection getConnection() throws SQLException Implements javax. Create an object handle for a database connection.
| |
| getLanguageConnection | back to summary |
|---|---|
public synchronized LanguageConnectionContext getLanguageConnection() throws SQLException
| |
| getLanguageConnectionContext | back to summary |
|---|---|
| private static LanguageConnectionContext getLanguageConnectionContext(final EmbedConnection conn) Gets the LanguageConnectionContext for this connection. | |
| getNewCurrentConnectionHandle | back to summary |
|---|---|
| pack-priv final Connection getNewCurrentConnectionHandle() throws SQLException | |
| getPassword | back to summary |
|---|---|
| pack-priv String getPassword() | |
| getRealConnection | back to summary |
|---|---|
| public synchronized EngineConnection getRealConnection() throws SQLException Implements org. Doc from org. Return the real JDBC connection for the brokered connection.
| |
| getUsername | back to summary |
|---|---|
| pack-priv String getUsername() | |
| isActive | back to summary |
|---|---|
| public boolean isActive() getter function for isActive
| |
| isInGlobalTransaction | back to summary |
|---|---|
| public boolean isInGlobalTransaction() Implements org. Doc from org. Is this a global transaction
| |
| isIsolationLevelSetUsingSQLorJDBC | back to summary |
|---|---|
| public boolean isIsolationLevelSetUsingSQLorJDBC() throws SQLException Implements org. Returns true if isolation level has been set using either JDBC api or SQL
| |
| notifyError | back to summary |
|---|---|
| public synchronized void notifyError(SQLException exception) | |
| notifyException | back to summary |
|---|---|
| public void notifyException(SQLException sqle) Implements org. Notify the control class that a SQLException was thrown during a call on one of the brokered connection's methods.
| |
| onStatementClose | back to summary |
|---|---|
| public void onStatementClose(PreparedStatement statement) Implements org. Raise the statementClosed event for all the listeners when the corresponding events occurs
| |
| onStatementErrorOccurred | back to summary |
|---|---|
| public void onStatementErrorOccurred(PreparedStatement statement, SQLException sqle) Implements org. Raise the statementErrorOccurred event for all the listeners when the corresponding events occurs
| |
| openRealConnection | back to summary |
|---|---|
| pack-priv final void openRealConnection() throws SQLException | |
| removeConnectionEventListener | back to summary |
|---|---|
| public final synchronized void removeConnectionEventListener(ConnectionEventListener listener) Implements javax. Remove an event listener.
| |
| removeStatementEventListener | back to summary |
|---|---|
| public void removeStatementEventListener(StatementEventListener listener) Implements javax. Removes the specified
| |
| resetIsolationLevelFlag | back to summary |
|---|---|
| public void resetIsolationLevelFlag() throws SQLException Implements org. Reset the isolation level flag used to keep state in BrokeredConnection. It will get set to true when isolation level is set using JDBC/SQL. It will get reset to false at the start and the end of a global transaction.
| |
| resetRealConnection | back to summary |
|---|---|
| pack-priv void resetRealConnection() throws SQLException | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Get the string representation of this pooled connection. A pooled connection is assigned a separate id from a physical connection. When a container calls PooledConnection.toString(), it gets the string representation of this id. This is useful for developers implementing connection pools when they are trying to debug pooled connections.
| |
| wrapStatement | back to summary |
|---|---|
| public Statement wrapStatement(Statement s) throws SQLException Implements org. No need to wrap statements for PooledConnections.
| |
| wrapStatement | back to summary |
|---|---|
| public PreparedStatement wrapStatement(PreparedStatement ps, String sql, Object generatedKeys) throws SQLException Implements org. 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
| |
| wrapStatement | back to summary |
|---|---|
| public CallableStatement wrapStatement(CallableStatement cs, String sql) throws SQLException Implements org. 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
| |