Name

ConnectionPool

Synopsis

This class implements a connection pool. It’s the same class as the ConnectionPool class described in O’Reilly’s Java Servlet Programming, copied with permission from Jason Hunter. It’s used by the DataSourceWrapper class to provide a JDBC 2.0 DataSource interface to the pool. It’s intended only as an example; there are many implementations with more features available on the Net.

Synopsis

Class name:

com.ora.jsp.sql.ConnectionPool

Extends:

None

Implements:

None

Constructors

public ConnectionPool(String driverClassName, String dbURL,

String user, String password, int initialConnections)

throws java.sql.SQLException, ClassNotFoundException

Creates a connection pool for the specified JDBC URL using the specified JDBC driver class and database user and password. The specified number of connections are created before service requests.

public ConnectionPool(java.util.Properties props, int initialConnections)

throws java.sql.SQLException, ClassNotFoundException

Creates a connection pool for the JDBC URL, JDBC driver class, database user, and password specified by the properties: connection.url, connection.driver, user, password. The specified number of connections are created before service requests.

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 to the pool. ...

Get JavaServer Pages, Second Edition 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.