Class DBConnectionManager

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DB_PROPS_PREFIX  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addConnectionProvider​(java.lang.String dataSourceName, ConnectionProvider provider)  
      java.sql.Connection getConnection​(java.lang.String dsName)
      Get a database connection from the DataSource with the given name.
      static DBConnectionManager getInstance()
      Get the class instance.
      void shutdown​(java.lang.String dsName)
      Shuts down database connections from the DataSource with the given name, if applicable for the underlying provider.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Method Detail

      • addConnectionProvider

        public void addConnectionProvider​(java.lang.String dataSourceName,
                                          ConnectionProvider provider)
      • getConnection

        public java.sql.Connection getConnection​(java.lang.String dsName)
                                          throws java.sql.SQLException
        Get a database connection from the DataSource with the given name.
        Returns:
        a database connection
        Throws:
        java.sql.SQLException - if an error occurs, or there is no DataSource with the given name.
      • getInstance

        public static DBConnectionManager getInstance()
        Get the class instance.
        Returns:
        an instance of this class
      • shutdown

        public void shutdown​(java.lang.String dsName)
                      throws java.sql.SQLException
        Shuts down database connections from the DataSource with the given name, if applicable for the underlying provider.
        Throws:
        java.sql.SQLException - if an error occurs, or there is no DataSource with the given name.