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: |
|
|
Extends: |
None |
|
Implements: |
None |
Constructors
-
public ConnectionPool(String driverClassName, String dbURL, String user, String password, int initialConnections)throws java.sql.SQLException, ClassNotFoundExceptionCreates 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, ClassNotFoundExceptionCreates 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.SQLExceptionReturns a
Connectionfrom the pool.-
public void returnConnection(java.sql.Connection returned) Used by the connection pool client to return a
Connectionto the pool. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access