com.holonplatform.jdbc.internal

## Class DefaultJdbcConnectionHandler

- java.lang.Object
- - com.holonplatform.jdbc.internal.DefaultJdbcConnectionHandler

- All Implemented Interfaces:
    JdbcConnectionHandler

      public class DefaultJdbcConnectionHandler
      extends Object
      implements JdbcConnectionHandler

  Default `JdbcConnectionHandler`, which uses `DataSource.getConnection()` to obtain a connection and `Connection.close()` to release the connection.
  Since:
    5.1.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.holonplatform.jdbc.JdbcConnectionHandler

      `JdbcConnectionHandler.ConnectionType`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultJdbcConnectionHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Connection` | `getConnection(DataSource dataSource, JdbcConnectionHandler.ConnectionType connectionType)` Get a `Connection` using given `DataSource`.
    `void` | `releaseConnection(Connection connection, DataSource dataSource, JdbcConnectionHandler.ConnectionType connectionType)` Release given `connection`, performing any connection finalization operation (for example to close the connection).

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

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

    - ### Methods inherited from interface com.holonplatform.jdbc.JdbcConnectionHandler

      `create`

- - ### Constructor Detail

    - #### DefaultJdbcConnectionHandler

          public DefaultJdbcConnectionHandler()

  - ### Method Detail

    - #### getConnection

          public Connection getConnection(DataSource dataSource,
                                          JdbcConnectionHandler.ConnectionType connectionType)
                                   throws SQLException

      Description copied from interface: `JdbcConnectionHandler`
      Get a `Connection` using given `DataSource`.
      Specified by:
        `getConnection` in interface `JdbcConnectionHandler`
      Parameters:
        `dataSource` - The `DataSource` from which to obtain connections
        `connectionType` - Connection type to discern if the connection will be used for initialization or for normal JDBC operations
      Returns:
        A connection, which must be not `null`
      Throws:
        `SQLException` - If an error occurred and the connection cannot be provided

    - #### releaseConnection

          public void releaseConnection(Connection connection,
                                        DataSource dataSource,
                                        JdbcConnectionHandler.ConnectionType connectionType)
                                 throws SQLException

      Description copied from interface: `JdbcConnectionHandler`
      Release given `connection`, performing any connection finalization operation (for example to close the connection).
      Specified by:
        `releaseConnection` in interface `JdbcConnectionHandler`
      Parameters:
        `connection` - The connection to release
        `dataSource` - The `DataSource` from which the connection was obtained
        `connectionType` - Connection type to discern if the connection was used for initialization or for normal JDBC operations
      Throws:
        `SQLException` - If an error occurred and the connection cannot be released

Copyright © 2019 The Holon Platform. All rights reserved.