|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fesenmeyer.dbnormalizer.core.dbaccess.DBConnectionManager
public final class DBConnectionManager
Singleton class to create, get and remove SQuirreL-DB connections. Provides a single access for DB-Connections and the possibility to work with more than one session at once.
Field Summary | |
---|---|
private HashMap<String,net.sourceforge.squirrel_sql.fw.sql.SQLConnection> |
connections
HashMap holding the connections (keyed by a session name). |
private static DBConnectionManager |
INSTANCE
The singleton instance. |
Constructor Summary | |
---|---|
private |
DBConnectionManager()
Makes the constructor inaccessible. |
Method Summary | |
---|---|
net.sourceforge.squirrel_sql.fw.sql.SQLConnection |
createAndAddConnection(String sessionName,
DBConfig dbConfig)
Creates, adds and returns a connection for the session with the specified name and DB configuration. |
net.sourceforge.squirrel_sql.fw.sql.SQLConnection |
getConnection(String sessionName)
Returns the connection for the session specified by argument sessionName. |
static DBConnectionManager |
getInstance()
Gets the single instance of the class. |
void |
removeConnection(String sessionName)
Removes and closes the connection for the session specified by argument sessionName. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private HashMap<String,net.sourceforge.squirrel_sql.fw.sql.SQLConnection> connections
private static DBConnectionManager INSTANCE
Constructor Detail |
---|
private DBConnectionManager()
Method Detail |
---|
public static DBConnectionManager getInstance()
public net.sourceforge.squirrel_sql.fw.sql.SQLConnection createAndAddConnection(String sessionName, DBConfig dbConfig) throws DBException
sessionName
- the session namedbConfig
- the DB-Configuration
DBException
- if an Exception occurs creating the connection.
Can have many reasons, e.g.:
public net.sourceforge.squirrel_sql.fw.sql.SQLConnection getConnection(String sessionName)
sessionName
- the session name
null
, otherwisepublic void removeConnection(String sessionName) throws DBException
sessionName
- the session name
DBException
- If an exception occurs when closing the connection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |