public class DBConnectionManager
extends java.lang.Object
Constructor and Description |
---|
DBConnectionManager() |
Modifier and Type | Method and Description |
---|---|
static DBConnection |
getConnection(java.lang.String url,
java.lang.String user,
java.lang.String pass,
java.lang.Object args)
Establishes a database connection using the specified parameters.
|
static DBConnection |
getConnection(java.lang.String url,
java.lang.String user,
java.lang.String pass,
java.lang.Object args,
java.lang.String sid)
Establishes a database connection using an existing connection object with the specified session
ID.
|
static void |
getConnectionInfo(Values report)
Provides information about the current open connections, including the number of open connections
and a list of open connections by session ID.
|
static void |
init()
Initializes the DBConnectionManager.
|
static void |
reapConnections()
Releases all open database connections whose sessions have expired.
|
static int |
returnAllConnections(java.lang.String sid)
Closes all connections associated with the specified session.
|
static void |
returnConnection(DBConnection conn)
Closes the connection and clears references to it, This action removes the connection from the
session-based sub-pool.
|
public static void init()
public static DBConnection getConnection(java.lang.String url, java.lang.String user, java.lang.String pass, java.lang.Object args) throws DBConnectionException
url
- A String specifying the URL of the database to which you want to connect.user
- A String specifying the user name that is to be used to connect to the
database.pass
- A String specifying the password that is to be used to connect to the
database.args
- An Object containing any additional arguments that the database or driver
needs in order to make a connection. For example, to establish a JDBC connection, you must provide
the driver name.DBConnectionException
- If a connection cannot be established.public static DBConnection getConnection(java.lang.String url, java.lang.String user, java.lang.String pass, java.lang.Object args, java.lang.String sid) throws DBConnectionException
url
- A String specifying the URL of the database to which you want to connect.user
- A String specifying the user name that is to be used to connect to the
database.pass
- A String specifying the password that is to be used to connect to the
database.sid
- A String specifying the session ID of the database connection you want to
reuse.DBConnectionException
- If anything goes wrong connecting to the
database.public static void returnConnection(DBConnection conn)
conn
- The DBConnection you want to close.public static int returnAllConnections(java.lang.String sid)
sid
- A String specifying the session ID whose database connections you want to
close.public static void getConnectionInfo(Values report)
report
- A Values object that contains the following keys:public static void reapConnections()