Class ConnectionManager

java.lang.Object
ca.spatial.table.ConnectionManager

public class ConnectionManager extends Object
Manage connections to databases.

This is a simple implementation that does not use connection pooling or JNDI. The assumption is that connecitons are only valid during the execution of a single application, thus sharing is of limited value.

  • Method Details

    • getConnection

      public static Connection getConnection()
      Get a previously defined connection from a list.
    • getConnection

      public static Connection getConnection(String label) throws SQLException
      Return a previously defined connection. If the connection has not been previously defined then prompt to define a new connection.
      Throws:
      SQLException
    • defineConnection

      public static Connection defineConnection(String label, String url, String username, String password) throws SQLException
      Define a new connection using a JDBC driver and add it to the pool.
      Throws:
      SQLException
    • removeConnection

      public static void removeConnection(String label)
      Remove a connection from the list, and also close it.