JDBCPooledConnection (HSQLDB 2.4.0 API)
Date: 2017-04-09

org.hsqldb.jdbc.pool

## Class JDBCPooledConnection

- java.lang.Object
- - org.hsqldb.jdbc.pool.JDBCPooledConnection

- All Implemented Interfaces:
    PooledConnection, JDBCConnectionEventListener
  Direct Known Subclasses:
    JDBCXAConnection

      public class JDBCPooledConnection
      extends Object
      implements PooledConnection, JDBCConnectionEventListener

  An implementations of `PooledConnection` for use by connection pooling software.

  The class maintains a lifetime connection to the database. The getConnection() method establishes a lease on the lifetime connection and returns a special JDBCConnection (userConnection) that is valid until it is closed.

  This class uses a dedicated HyperSQL method to guarantee each lease on the connection starts with the original state of the connection.

  The ConnectionEventLister objects that have been registered with this PooledConnection are notified when each lease expires, or an unrecoverable error occurs on the connection to the database.

  Since:
    JDK 1.2, HSQLDB 2.0
  Author:
    Fred Toussi (fredt@users dot sourceforge.net)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JDBCPooledConnection(JDBCConnection connection)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addConnectionEventListener(ConnectionEventListener listener)`
    `void` | `addStatementEventListener(StatementEventListener listener)`
    `void` | `close()`
    `void` | `connectionClosed()`
    `void` | `connectionErrorOccurred(SQLException e)`
    `Connection` | `getConnection()`
    `boolean` | `isInUse()` Returns true if getConnection() has been called and a leas has been given.
    `void` | `release()` Force close the userConnection, and connection, no close event is fired.
    `void` | `removeConnectionEventListener(ConnectionEventListener listener)`
    `void` | `removeStatementEventListener(StatementEventListener listener)`
    `void` | `reset()` Force close the userConnection, no close event is fired.

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

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

- - ### Constructor Detail

    - #### JDBCPooledConnection

          public JDBCPooledConnection(JDBCConnection connection)

  - ### Method Detail

    - #### getConnection

          public Connection getConnection()
                                   throws SQLException

      Specified by:
        `getConnection` in interface `PooledConnection`
      Throws:
        `SQLException`

    - #### close

          public void close()
                     throws SQLException

      Specified by:
        `close` in interface `PooledConnection`
      Throws:
        `SQLException`

    - #### addConnectionEventListener

          public void addConnectionEventListener(ConnectionEventListener listener)

      Specified by:
        `addConnectionEventListener` in interface `PooledConnection`

    - #### removeConnectionEventListener

          public void removeConnectionEventListener(ConnectionEventListener listener)

      Specified by:
        `removeConnectionEventListener` in interface `PooledConnection`

    - #### addStatementEventListener

          public void addStatementEventListener(StatementEventListener listener)

      Specified by:
        `addStatementEventListener` in interface `PooledConnection`

    - #### removeStatementEventListener

          public void removeStatementEventListener(StatementEventListener listener)

      Specified by:
        `removeStatementEventListener` in interface `PooledConnection`

    - #### connectionClosed

          public void connectionClosed()

      Specified by:
        `connectionClosed` in interface `JDBCConnectionEventListener`

    - #### connectionErrorOccurred

          public void connectionErrorOccurred(SQLException e)

      Specified by:
        `connectionErrorOccurred` in interface `JDBCConnectionEventListener`

    - #### isInUse

          public boolean isInUse()

      Returns true if getConnection() has been called and a leas has been given.
      Returns:
        boolean

    - #### reset

          public void reset()

      Force close the userConnection, no close event is fired.

    - #### release

          public void release()

      Force close the userConnection, and connection, no close event is fired.

Copyright © 2001 - 2017 HSQL Development Group.