Name

ConnectionPool

Synopsis

Class Name:

com.ora.jsp.sql.ConnectionPool

Extends:

None

Implements:

None

Description

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

Class Summary

public class ConnectionPool {
  // Constructor
  public ConnectionPool(String dbURL, String user, String password,
    String driverClassName, int initialConnections, int increment)
    throws java.sql.SQLException, ClassNotFoundException;

  // Methods
  public java.sql.Connection getConnection( )
    throws java.sql.SQLException;
  public void returnConnection(java.sql.Connection returned);
}

Constructor

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

Creates a connection pool for the specified JDBC URL using the specified JDBC driver class and database user ID and password. The specified number of connections is created initially, and the pool is expanded in the specified increments if the pool is empty when a new request is received.

Methods

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

Returns a Connection from the pool.

public void returnConnection(java.sql.Connection returned)

Used by the connection pool client to return a Connection ...

Get Java Server Pages now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.