public class DatabaseConnectionManager
extends java.lang.Object
Constructor and Description |
---|
DatabaseConnectionManager() |
Modifier and Type | Method and Description |
---|---|
static java.sql.Connection |
getUserConnection(java.lang.Object user)
This method retrieves the connection associated with a particular user.
|
static void |
registerConnectionUser(java.lang.Object user,
java.lang.String dataBaseUrl)
This method first checks if the connection exists through its url.
|
static void |
removeUser(java.lang.Object user)
This method removes the user from the ConnectionUsers Map and
eventually closes the connection if there is no user left.
|
public static void registerConnectionUser(java.lang.Object user, java.lang.String dataBaseUrl) throws java.io.IOException
user
- the object instance that uses the database connectiondataBaseUrl
- the database urljava.io.IOException
- if there is a connection problempublic static java.sql.Connection getUserConnection(java.lang.Object user)
user
- the Object instance that uses this connectionpublic static void removeUser(java.lang.Object user) throws java.sql.SQLException
user
- the Object instance that uses this connectionjava.sql.SQLException