edu.ucsb.nceas.metacat.dataquery

## Class PostgresDatabaseConnectionPool

- java.lang.Object
- - edu.ucsb.nceas.metacat.dataquery.PostgresDatabaseConnectionPool

- All Implemented Interfaces:
    org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface

      public class PostgresDatabaseConnectionPool
      extends java.lang.Object
      implements org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface

  This class implements DataConnetionPoolInterface to provide a connection for testing. Database information in this class will be read from property file.
  Author:
    tao

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static org.apache.commons.logging.Log` | `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PostgresDatabaseConnectionPool()` Constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.sql.Connection` | `getConnection()` Gets a database connection from the pool
    `java.lang.String` | `getDBAdapterName()` Get dabase adpater name.
    `static void` | `main(java.lang.String[] arg)`
    `boolean` | `returnConnection(java.sql.Connection conn)` Returns checked out dabase connection to the pool

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

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

- - ### Field Detail

    - #### log

          public static org.apache.commons.logging.Log log

  - ### Constructor Detail

    - #### PostgresDatabaseConnectionPool

          public PostgresDatabaseConnectionPool()

      Constructor. Loading database parameter from property file

  - ### Method Detail

    - #### getDBAdapterName

          public java.lang.String getDBAdapterName()

      Get dabase adpater name.
      Specified by:
        `getDBAdapterName` in interface `org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface`
      Returns:
        database adapter name

    - #### getConnection

          public java.sql.Connection getConnection()
                                            throws java.sql.SQLException,
                                                   org.ecoinformatics.datamanager.database.ConnectionNotAvailableException

      Gets a database connection from the pool
      Specified by:
        `getConnection` in interface `org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface`
      Returns:
        checked out connection
      Throws:
        `java.sql.SQLException`
        `org.ecoinformatics.datamanager.database.ConnectionNotAvailableException`

    - #### returnConnection

          public boolean returnConnection(java.sql.Connection conn)

      Returns checked out dabase connection to the pool
      Specified by:
        `returnConnection` in interface `org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface`
      Parameters:
        `conn` - Connection needs to be returned.
      Returns:
        indicator if the connection was returned successfully

    - #### main

          public static void main(java.lang.String[] arg)

Copyright © 2023 Regents of the University of California. All Rights Reserved.