OracleAS Personalization Java API Reference
10g Release 2 (10.1.2)

B14053-01


oracle.dmt.op.re.reapi.rt
Class DBConnectionManager

java.lang.Object
  extended byoracle.dmt.op.re.reapi.rt.DBConnectionManager


public class DBConnectionManager
extends java.lang.Object

This is a singleton class that provides access to one or many connection pools. For REAPI_RT internal use only.


Method Summary
void addPool(java.lang.String poolName, java.lang.String dbURL, java.lang.String user, java.lang.String passWd, int maxConn)
Creates an instance of DBConnectionPool.
void addPool(java.lang.String poolName, java.lang.String dbURL, java.lang.String user, java.lang.String passWd, int maxConn, int timeout)
Creates an instance of DBConnectionPool with the ability to closed idle connection after a specified period.
void freeConnection(java.lang.String name, java.sql.Connection con)
Returns a connection to the named pool when it is freed.
java.sql.Connection getConnection(java.lang.String name)
Returns an open connection.
java.sql.Connection getConnection(java.lang.String name, long time)
Returns an open connection from the named pool.
static DBConnectionManager getInstance(int nTrace)
Returns the single instance, creating one if it's the first time this method is called.
int getNumberOfFreeConnections(java.lang.String name)
Returns number of free connections in the named pool.
int getNumberOfOpenConnections(java.lang.String name)
Returns number of open connections in the named pool.
void release()
Closes all open connections and deregisters JDBC drivers.
void removePool(java.lang.String poolName)
Removes an instance of DBConnectionPool.

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail

getInstance

public static DBConnectionManager getInstance(int nTrace)
Returns the single instance, creating one if it's the first time this method is called.
Returns:
DBConnectionManager the single instance

freeConnection

public void freeConnection(java.lang.String name,
                           java.sql.Connection con)
Returns a connection to the named pool when it is freed.
Parameters:
name - the pool name as defined in the properties file
con - the connection

getConnection

public java.sql.Connection getConnection(java.lang.String name)
                                  throws ConnectionPoolIsFullException
Returns an open connection. If none is available, and the max number of connections has not been reached, a new connection is created.
Parameters:
name - the pool name
Returns:
Connection the connection or null
Throws:
ConnectionPoolIsFullException

getConnection

public java.sql.Connection getConnection(java.lang.String name,
                                         long time)
                                  throws ConnectionPoolIsFullException
Returns an open connection from the named pool. If none is available, and the max number of connections has not been reached, a new connection is created. If the max number has been reached, waits until one is available, or return null if the specified time elapses.
Parameters:
name - the pool name
time - the number of milliseconds to wait
Returns:
Connection the connection or null
Throws:
ConnectionPoolIsFullException

getNumberOfOpenConnections

public int getNumberOfOpenConnections(java.lang.String name)
Returns number of open connections in the named pool.
Parameters:
name - the pool name

getNumberOfFreeConnections

public int getNumberOfFreeConnections(java.lang.String name)
Returns number of free connections in the named pool.
Parameters:
name - the pool name

release

public void release()
             throws java.sql.SQLException
Closes all open connections and deregisters JDBC drivers.
Throws:
java.sql.SQLException

addPool

public void addPool(java.lang.String poolName,
                    java.lang.String dbURL,
                    java.lang.String user,
                    java.lang.String passWd,
                    int maxConn)
Creates an instance of DBConnectionPool. A DBConnectionPool can be defined with the following attributes:
     <poolname>.dbURL       the JDBC URL for the database
     <poolname>.user        user name (optional)
     <poolname>.password    password (if user-specified)
     <poolname>.maxconn     the maximum number of connections (optional)
 
Parameters:
poolName - the name of the connection pool
dbURL - the JDBC URL for the database
user - the user name
maxConn - the maximum number of connections allowed

addPool

public void addPool(java.lang.String poolName,
                    java.lang.String dbURL,
                    java.lang.String user,
                    java.lang.String passWd,
                    int maxConn,
                    int timeout)
Creates an instance of DBConnectionPool with the ability to closed idle connection after a specified period. A DBConnectionPool can be defined with the following attributes:
     <poolname>.dbURL       the JDBC URL for the database
     <poolname>.user        user name (optional)
     <poolname>.password    password (if user-specified)
     <poolname>.maxconn     the maximum number of connections (optional)
     <poolname>.timeout     idle time allowed for connections, in seconds
 
Parameters:
poolName - the name of the connection pool
dbURL - the JDBC URL for the database
user - the user name
maxConn - the maximum number of connections allowed
timeout - idle time allowed for open connections, in seconds

removePool

public void removePool(java.lang.String poolName)
Removes an instance of DBConnectionPool.

OracleAS Personalization Java API Reference
10g Release 2 (10.1.2)

B14053-01


Copyright © 2005 Oracle. All Rights Reserved.