com.wm.app.b2b.server
Class DBConnectionManager

java.lang.Object
  extended by com.wm.app.b2b.server.DBConnectionManager

public class DBConnectionManager
extends java.lang.Object

The DBConnectionManager class contains methods that are used to manage database connections.


Constructor Summary
DBConnectionManager()
           
 
Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConnectionManager

public DBConnectionManager()
Method Detail

init

public static void init()
Initializes the DBConnectionManager.


getConnection

public static DBConnection getConnection(java.lang.String url,
                                         java.lang.String user,
                                         java.lang.String pass,
                                         java.lang.Object args)
                                  throws DBConnectionException
Establishes a database connection using the specified parameters. If there is an alternate connection provider defined in server.cnf, it will be used to make the connection. However, if it demurs or there is no alternate provider, the default behavior is to use the JDBCConnection.

Parameters:
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.
Returns:
A DBConnection to the specified database.
Throws:
DBConnectionException - If a connection cannot be established.

getConnection

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
Establishes a database connection using an existing connection object with the specified session ID. If there is an alternate connection provider defined in server.cnf, it will be used to make the connection. However, if it demurs or there is no alternate provider, the default behavior is to use the JDBCConnection.

Parameters:
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.
Returns:
A DBConnection to the specified database.
Throws:
DBConnectionException - If anything goes wrong connecting to the database.

returnConnection

public static void returnConnection(DBConnection conn)
Closes the connection and clears references to it, This action removes the connection from the session-based sub-pool.

Parameters:
conn - The DBConnection you want to close.

returnAllConnections

public static int returnAllConnections(java.lang.String sid)
Closes all connections associated with the specified session.

Parameters:
sid - A String specifying the session ID whose database connections you want to close.
Returns:
An int indicating the number of connections closed or -1 if the connections could not be closed successfully.

getConnectionInfo

public 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.

Parameters:
report - A Values object that contains the following keys:

Integer $dbPoolDrawAttempt
Integer $dbPoolDrawOK
Integer $dbCacheHit
Integer $dbTotalJDBC
Integer $dbTotalAlternate
Values $dbConnections
- String url
- String user
- String class

reapConnections

public static void reapConnections()
Releases all open database connections whose sessions have expired.