Interface IDBConnectionPool


public interface IDBConnectionPool
Interface used to retrieve a connection from a connection pool.
Author:
Christopher Mindus
  • Field Details

    • PN_DESCRIPTION

      static final String PN_DESCRIPTION
      Property name: description.
      See Also:
    • PN_CLASS_PATH

      static final String PN_CLASS_PATH
      Property name: class path, comma separated. Every comma separates two entries: a path cannot hold one.
      See Also:
    • PN_DRIVER_CLASS_NAME

      static final String PN_DRIVER_CLASS_NAME
      Property name: driver class name.
      See Also:
    • PN_URL

      static final String PN_URL
      Property name: JDBC URL.
      See Also:
    • PN_USER_NAME

      static final String PN_USER_NAME
      Property name: user name.
      See Also:
    • PN_PASSWORD

      static final String PN_PASSWORD
      Property name: password.
      See Also:
    • PN_PASSWORD_SECRET

      static final String PN_PASSWORD_SECRET
      Property name: the key of the password in the secrets store of the machine, e.g. dbconf.mls/password. It is used only when no PN_PASSWORD is given: the "dbconf.properties" file then carries no password, and the value comes from the secrets resolver handed to JDBCHelper.from.
      See Also:
    • PN_DEFAULT_AUTO_COMMIT

      static final String PN_DEFAULT_AUTO_COMMIT
      Property name: default auto-commit flag. When it is not set, the connections of the pool are in the default mode of the JDBC driver: auto-commit on, for every supported product.
      See Also:
  • Method Details

    • getConnection

      Connection getConnection() throws SQLException
      Gets a connection from the pool.

      While the connection is in auto-commit mode, its commit() and rollback() (the ones without a savepoint) do nothing, on every database product: the database has committed each statement already. The code of the server commits and rolls back by hand wherever it writes; Derby accepts that in auto-commit mode, the PostgreSQL and MySQL drivers throw, and the pool makes them alike. On a connection that is not in auto-commit mode both are the driver's own.

      Throws:
      SQLException - For SQL errors.
    • getFlavor

    • getName

      String getName()
      Gets the name of the connection pool.
      Returns:
      The name of the connection pool.
    • dispose

      void dispose() throws SQLException
      Disposes of the pool.

      Closes and releases all idle connections that are currently stored in the connection pool associated with this data source.

      Connections that are checked out to clients when this method is invoked are not affected. When client applications subsequently invoke Connection.close() to return these connections to the pool, the underlying JDBC connections are closed.

      Attempts to acquire connections using getConnection() after this method has been invoked result in SQLExceptions.

      This method is idempotent - i.e., closing an already closed BasicDataSource has no effect and does not generate exceptions.

      Throws:
      SQLException - If an error occurs closing idle connections
    • isDisposed

      boolean isDisposed()
      Checks if the connection pool is disposed of.
      Returns:
      true for disposed of, false if not disposed of and ready.