com.ora.jsp.sql
Class ConnectionPool

java.lang.Object
  extended bycom.ora.jsp.sql.ConnectionPool

public class ConnectionPool
extends java.lang.Object

This class implements a connection pool. It's the same as the ConnectionPool class described in Java Servlet Programming (O'Reilly), Second Edition, copied with permission from Jason Hunter. It's used by the DataSourceWrapper class to provide a JDBC 2.0 DataSource interface to the pool.

Version:
2.0
Author:
Jason Hunter,

Field Summary
private  java.util.Hashtable connections
           
private  java.util.Properties props
           
 
Constructor Summary
ConnectionPool(java.util.Properties props, int initialConnections)
           
ConnectionPool(java.lang.String driverClassName, java.lang.String dbURL, java.lang.String user, java.lang.String password, int initialConnections)
           
 
Method Summary
 java.sql.Connection getConnection()
           
private  java.sql.Connection getNewConnection()
           
private  void initializePool(java.util.Properties props, int initialConnections)
           
 void returnConnection(java.sql.Connection returned)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connections

private java.util.Hashtable connections

props

private java.util.Properties props
Constructor Detail

ConnectionPool

public ConnectionPool(java.util.Properties props,
                      int initialConnections)
               throws java.sql.SQLException,
                      java.lang.ClassNotFoundException

ConnectionPool

public ConnectionPool(java.lang.String driverClassName,
                      java.lang.String dbURL,
                      java.lang.String user,
                      java.lang.String password,
                      int initialConnections)
               throws java.sql.SQLException,
                      java.lang.ClassNotFoundException
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

returnConnection

public void returnConnection(java.sql.Connection returned)

initializePool

private void initializePool(java.util.Properties props,
                            int initialConnections)
                     throws java.sql.SQLException,
                            java.lang.ClassNotFoundException
Throws:
java.sql.SQLException
java.lang.ClassNotFoundException

getNewConnection

private java.sql.Connection getNewConnection()
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException