com.codestudio.util
Class SQLManager

java.lang.Object
  |
  +--com.codestudio.util.PoolManager
        |
        +--com.codestudio.util.SQLManager
All Implemented Interfaces:
java.io.Serializable

public class SQLManager
extends PoolManager

See Also:
Serialized Form

Fields inherited from class com.codestudio.util.PoolManager
defaultpool, pools
 
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)
           
 java.util.Enumeration getAllPoolnames()
          Overridden implementation ensures the config is loaded.
 java.lang.String getConfigFile()
           
static SQLManager getInstance()
          This method retrieves the singleton SQLManager instance created when the class was first loaded.
static SQLManager getInstance(java.lang.String confFile)
          If a configuration file other than the default is specified, then the singleton instance will be recreated using the new file.
 ObjectPool getPool(java.lang.String name)
          Overridden implementation ensures the config is 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)
          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.
 void setConfigFile(java.lang.String filename)
           
 
Methods inherited from class com.codestudio.util.PoolManager
addPool, destroyPools, 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 SQLManager getInstance()
This method retrieves the singleton SQLManager instance created when the class was first loaded.

getInstance

public static SQLManager getInstance(java.lang.String confFile)
If a configuration file other than the default is specified, then the singleton instance will be recreated using the new file. Subsequent invocations of this method with the same file name passed as a parameter will not cause a recreation, it will simply return the singleton created based on the previous parsing of that config file.

createPool

public JDBCPool createPool(PoolMetaData metad)

setConfigFile

public void setConfigFile(java.lang.String filename)

getConfigFile

public java.lang.String getConfigFile()

getPool

public ObjectPool getPool(java.lang.String name)
Overridden implementation ensures the config is loaded.
Overrides:
getPool in class PoolManager

getPoolByJNDIName

public ObjectPool getPoolByJNDIName(java.lang.String name)

getAllPoolnames

public java.util.Enumeration getAllPoolnames()
Overridden implementation ensures the config is loaded.
Overrides:
getAllPoolnames in class PoolManager

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.

returnConnection

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

requestConnection

public java.sql.Connection requestConnection(java.lang.String dbname)
                                      throws java.sql.SQLException
Get a connection from a particular database 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 © 1999-2001 The Code Studio. All Rights Reserved.