Package ca.spatial.table
Class ConnectionManager
java.lang.Object
ca.spatial.table.ConnectionManager
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 Summary
Modifier and TypeMethodDescriptionstatic Connection
defineConnection(String label, String url, String username, String password)
Define a new connection using a JDBC driver and add it to the pool.static Connection
Get a previously defined connection from a list.static Connection
getConnection(String label)
Return a previously defined connection.static void
removeConnection(String label)
Remove a connection from the list, and also close it.
-
Method Details
-
getConnection
Get a previously defined connection from a list. -
getConnection
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 SQLExceptionDefine a new connection using a JDBC driver and add it to the pool.- Throws:
SQLException
-
removeConnection
Remove a connection from the list, and also close it.
-