jrun.sql.pool
Class JDBCManager

java.lang.Object
  |
  +--jrunx.pool.PoolManager
        |
        +--jrun.sql.pool.JDBCManager
All Implemented Interfaces:
java.io.Serializable

public class JDBCManager
extends PoolManager

The PoolManager subclass for multiple JDBCPools.

Author:
PS Neville
See Also:
Serialized Form

Method Summary
 void checkCredentials(java.lang.String dbname, java.lang.String user, java.lang.String passwd)
           
static void closeResources(java.sql.Statement statement, java.sql.ResultSet resultSet)
          Static method that closes the statement and result sets in one place; this is here as a convenience to shorten the finally block in statements.
static void closeResultSet(java.sql.ResultSet rs)
          This method closes the given resultset.
static void closeStatement(java.sql.Statement statement)
          Closes the given statement.
 void collectResources(java.sql.Statement s, java.sql.ResultSet r)
           
 JDBCPool createPool(PoolMetaData metad)
           
static JDBCManager getInstance()
          This method retrieves the singleton JDBCManager instance created when the class was first loaded.
 ObjectPool getPoolByJNDIName(java.lang.String name)
           
 java.sql.Connection requestConnection()
          Get a connection from the first (default) database connection pool.
 java.sql.Connection requestConnection(java.lang.String dbname)
           
 java.sql.Connection requestConnection(java.lang.String dbname, java.lang.String username, java.lang.String password)
          Get a connection from a particular database pool.
 void returnConnection(java.sql.Connection con)
          Return a connection to the default pool.
 void returnConnection(java.lang.String dbname, java.sql.Connection con)
          Return a connection to a particular database pool.
 
Methods inherited from class jrunx.pool.PoolManager
addPool, destroyPools, getAllPoolnames, getPool, getPools, removePool, requestObject, requestObject, returnObject, returnObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static JDBCManager getInstance()
This method retrieves the singleton JDBCManager instance created when the class was first loaded.

createPool

public JDBCPool createPool(PoolMetaData metad)

getPoolByJNDIName

public ObjectPool getPoolByJNDIName(java.lang.String name)

checkCredentials

public void checkCredentials(java.lang.String dbname,
                             java.lang.String user,
                             java.lang.String passwd)
                      throws java.sql.SQLException

requestConnection

public java.sql.Connection requestConnection()
                                      throws java.sql.SQLException
Get a connection from the first (default) database connection pool.

requestConnection

public java.sql.Connection requestConnection(java.lang.String dbname,
                                             java.lang.String username,
                                             java.lang.String password)
                                      throws java.sql.SQLException
Get a connection from a particular database pool.

requestConnection

public java.sql.Connection requestConnection(java.lang.String dbname)
                                      throws java.sql.SQLException

returnConnection

public void returnConnection(java.sql.Connection con)
Return a connection to the default pool.

returnConnection

public void returnConnection(java.lang.String dbname,
                             java.sql.Connection con)
Return a connection to a particular database pool. No Longer necessary: The con is a handle that will cause the PooledConnection to return to the correct pool. Method kept for backwards-compatibility purposes.

closeResources

public static void closeResources(java.sql.Statement statement,
                                  java.sql.ResultSet resultSet)
Static method that closes the statement and result sets in one place; this is here as a convenience to shorten the finally block in statements. Both arguments may be null.
Parameters:
statement - the statement to be closed
resultSet - the resultSet to be closed

collectResources

public void collectResources(java.sql.Statement s,
                             java.sql.ResultSet r)

closeStatement

public static void closeStatement(java.sql.Statement statement)
Closes the given statement. It is here to get rid of the extra try block in finally blocks that need to close statements
Parameters:
statement - the statement to be closed. May be null.

closeResultSet

public static void closeResultSet(java.sql.ResultSet rs)
This method closes the given resultset. It is here to get rid of the extra try block in finally blocks.
Parameters:
rs - the ResultSet to be closed. May be null.


Copyright � 2002 Macromedia Corporation. All Rights Reserved.