Documentation of 'org.apache.derby.client.ClientPooledConnection' Java class
ClientPooledConnection
org.apache.derby.client

Class ClientPooledConnection

  • All Implemented Interfaces:
    javax.sql.PooledConnection
    Direct Known Subclasses:
    ClientXAConnection


    public class ClientPooledConnection
    extends java.lang.Object
    implements javax.sql.PooledConnection
    A physical connection to a data source, to be used for creating logical connections to the same data source.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void addConnectionEventListener(javax.sql.ConnectionEventListener listener) 
      void addStatementEventListener(javax.sql.StatementEventListener listener)
      Registers a StatementEventListener with this PooledConnection object.
      void close()
      Closes the physical connection to the data source and frees all associated resources.
      java.sql.Connection getConnection()
      Creates a logical connection.
      void informListeners(SqlException exception)
      Inform listeners that an error has occured on the connection, if the error severity is high enough.
      boolean isStatementPoolingEnabled()
      Tells is statement pooling is enabled or not.
      void nullLogicalConnection()
      Used by LogicalConnection.close in some circumstances when it disassociates itself from the pooled connection.
      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.
      void recycleConnection()
      Inform listeners that the logical connection has been closed and that the physical connection is ready for reuse.
      void removeConnectionEventListener(javax.sql.ConnectionEventListener listener) 
      void removeStatementEventListener(javax.sql.StatementEventListener listener)
      Removes the specified previously registered listener object from the list of components that would be informed of events with a PreparedStatement object.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ClientPooledConnection

        public ClientPooledConnection(BasicClientDataSource40 ds,
                                      LogWriter logWriter,
                                      java.lang.String user,
                                      java.lang.String password)
                               throws java.sql.SQLException
        Constructor for non-XA pooled connections.

        Using standard Java APIs, a CPDS is passed in. Arguments for user/password overrides anything on the data source.

        Parameters:
        ds - data source creating this pooled connection
        logWriter - destination for log messages
        user - user name
        password - user password
        Throws:
        java.sql.SQLException - if creating the pooled connection fails due problems in the database, or problems communicating with the database
      • ClientPooledConnection

        public ClientPooledConnection(BasicClientDataSource40 ds,
                                      LogWriter logWriter,
                                      java.lang.String user,
                                      java.lang.String password,
                                      int rmId)
                               throws java.sql.SQLException
        Constructor for XA pooled connections only.

        Using standard Java APIs, a CPDS is passed in. Arguments for user/password overrides anything on the data source.

        Parameters:
        ds - data source creating this pooled connection
        logWriter - destination for log messages
        user - user name
        password - user password
        rmId - resource manager id
        Throws:
        java.sql.SQLException - if creating the pooled connection fails due problems in the database, or problems communicating with the database
    • Method Detail

      • isStatementPoolingEnabled

        public boolean isStatementPoolingEnabled()
        Tells is statement pooling is enabled or not.
        Returns:
        true if enabled, false if disabled.
      • close

        public void close()
                   throws java.sql.SQLException
        Closes the physical connection to the data source and frees all associated resources.
        Specified by:
        close in interface javax.sql.PooledConnection
        Throws:
        java.sql.SQLException - if closing the connection causes an error. Note that this connection can still be considered closed even if an error occurs.
      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Creates a logical connection.

        This is the standard API for getting a logical connection handle for a pooled connection. No "resettable" properties are passed, so user, password, and all other properties may not change.

        Specified by:
        getConnection in interface javax.sql.PooledConnection
        Throws:
        java.sql.SQLException - if creating a new logical connection fails
      • addConnectionEventListener

        public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
        Specified by:
        addConnectionEventListener in interface javax.sql.PooledConnection
      • removeConnectionEventListener

        public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
        Specified by:
        removeConnectionEventListener in interface javax.sql.PooledConnection
      • recycleConnection

        public void recycleConnection()
        Inform listeners that the logical connection has been closed and that the physical connection is ready for reuse.

        Not public, but needs to be visible to am.LogicalConnection

      • informListeners

        public void informListeners(SqlException exception)
        Inform listeners that an error has occured on the connection, if the error severity is high enough.

        Not public, but needs to be visible to am.LogicalConnection

        Parameters:
        exception - the exception that occurred on the connection
      • nullLogicalConnection

        public void nullLogicalConnection()
        Used by LogicalConnection.close in some circumstances when it disassociates itself from the pooled connection.
      • addStatementEventListener

        public void addStatementEventListener(javax.sql.StatementEventListener listener)
        Registers a StatementEventListener with this PooledConnection object. Components that wish to be informed of events associated with the PreparedStatement object created by this PooledConnection like the close or error occurred event can register a StatementEventListener with this PooledConnection object.
        Specified by:
        addStatementEventListener in interface javax.sql.PooledConnection
        Parameters:
        listener - A component that implements the StatementEventListener interface and wants to be notified of Statement closed or or Statement error occurred events
      • removeStatementEventListener

        public void removeStatementEventListener(javax.sql.StatementEventListener listener)
        Removes the specified previously registered listener object from the list of components that would be informed of events with a PreparedStatement object.
        Specified by:
        removeStatementEventListener in interface javax.sql.PooledConnection
        Parameters:
        listener - The previously registered event listener that needs to be removed from the list of components
      • onStatementClose

        public void onStatementClose(java.sql.PreparedStatement statement)
        Raise the statementClosed event for all the listeners when the corresponding events occurs.
        Parameters:
        statement - The PreparedStatement that was closed
      • onStatementErrorOccurred

        public void onStatementErrorOccurred(java.sql.PreparedStatement statement,
                                             java.sql.SQLException sqle)
        Raise the statementErrorOccurred event for all the listeners when the corresponding events occurs.
        Parameters:
        statement - The PreparedStatement on which error occurred
        sqle - The SQLException associated with the error that caused the invalidation of the PreparedStatements

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.