Package org.firebirdsql.ds

## Class FBPooledConnection

- java.lang.Object
- - org.firebirdsql.ds.FBPooledConnection

- All Implemented Interfaces:
    `javax.sql.PooledConnection`
  Direct Known Subclasses:
    `FBXAConnection`

      public class FBPooledConnection
      extends java.lang.Object
      implements javax.sql.PooledConnection

  PooledConnection implementation for `FBConnectionPoolDataSource`
  Since:
    2.2
  Author:
    Mark Rotteveel

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `FBPooledConnection​(java.sql.Connection connection)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addConnectionEventListener​(javax.sql.ConnectionEventListener listener)` |
    `void` | `addStatementEventListener​(javax.sql.StatementEventListener listener)` |
    `void` | `close()` |
    `protected org.firebirdsql.ds.PooledConnectionHandler` | `createConnectionHandler​(java.sql.Connection connection)` | Creates the PooledConnectionHandler for the connection.
    `protected void` | `fireConnectionClosed()` | Helper method to fire the connectionClosed event.
    `protected void` | `fireConnectionError​(java.sql.SQLException ex)` | Helper method to fire the connectionErrorOccurred event.
    `protected void` | `fireFatalConnectionError​(java.sql.SQLException ex)` | Helper method to fire the connectionErrorOccurred event.
    `java.sql.Connection` | `getConnection()` |
    `protected void` | `releaseConnectionHandler​(org.firebirdsql.ds.PooledConnectionHandler pch)` | Releases the current handler if it is equal to the handler passed in `pch`.
    `void` | `removeConnectionEventListener​(javax.sql.ConnectionEventListener listener)` |
    `void` | `removeStatementEventListener​(javax.sql.StatementEventListener listener)` |
    `protected void` | `resetConnection​(java.sql.Connection connection)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FBPooledConnection

          protected FBPooledConnection​(java.sql.Connection connection)

  - ### Method Detail

    - #### getConnection

          public java.sql.Connection getConnection()
                                            throws java.sql.SQLException

      Specified by:
        `getConnection` in interface `javax.sql.PooledConnection`
      Throws:
        `java.sql.SQLException`

    - #### resetConnection

          protected void resetConnection​(java.sql.Connection connection)
                                  throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### createConnectionHandler

          protected org.firebirdsql.ds.PooledConnectionHandler createConnectionHandler​(java.sql.Connection connection)

      Creates the PooledConnectionHandler for the connection.

      Subclasses may override this method to return their own subclass of PooledConnectionHandler.

      Parameters:
        `connection` - Connection
      Returns:
        PooledConnectionHandler

    - #### close

          public void close()
                     throws java.sql.SQLException

      Specified by:
        `close` in interface `javax.sql.PooledConnection`
      Throws:
        `java.sql.SQLException`

    - #### fireFatalConnectionError

          protected void fireFatalConnectionError​(java.sql.SQLException ex)

      Helper method to fire the connectionErrorOccurred event. To be used with fatal (connection) errors only.
      Parameters:
        `ex` - The exception

    - #### fireConnectionError

          protected void fireConnectionError​(java.sql.SQLException ex)

      Helper method to fire the connectionErrorOccurred event.

      This method will decide which errors warrant a connectionErrorOccurred event to be reported or not.

      Parameters:
        `ex` - The exception

    - #### fireConnectionClosed

          protected void fireConnectionClosed()

      Helper method to fire the connectionClosed event.

    - #### releaseConnectionHandler

          protected void releaseConnectionHandler​(org.firebirdsql.ds.PooledConnectionHandler pch)

      Releases the current handler if it is equal to the handler passed in `pch`.

      To be called by the PooledConnectionHandler when it has been closed.

      Parameters:
        `pch` - PooledConnectionHandler to release.

    - #### 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`

    - #### addStatementEventListener

          public void addStatementEventListener​(javax.sql.StatementEventListener listener)

      Specified by:
        `addStatementEventListener` in interface `javax.sql.PooledConnection`

    - #### removeStatementEventListener

          public void removeStatementEventListener​(javax.sql.StatementEventListener listener)

      Specified by:
        `removeStatementEventListener` in interface `javax.sql.PooledConnection`