net.sf.jso.sql
Interface ConnectionPool

All Known Implementing Classes:
DynamicPool, NoPool, SimplePool

public interface ConnectionPool

Interface for connection pooling management classes.


Method Summary
 java.sql.Connection borrowConnection()
          Borrows a connection from the pool.
 void close()
          Closes the pool.
 ConnectionPoolInfo getPoolInfo()
          Gets connection pool information.
 boolean isOpen()
          Indicates if the pool is open.
 void open(java.lang.String anUrl, java.lang.String anUser, java.lang.String aPassword)
          Opens the pool.
 void open(java.lang.String aDriverClass, java.lang.String anUrl, java.lang.String anUser, java.lang.String aPassword)
          Opens the pool.
 void returnConnection(java.sql.Connection aConnection)
          Returns a connection to the pool.
 

Method Detail

open

public void open(java.lang.String anUrl,
                 java.lang.String anUser,
                 java.lang.String aPassword)
          throws java.sql.SQLException
Opens the pool.

Parameters:
anUrl - A database url of the form jdbc:subprotocol:subname.
anUser - The database user on whose behalf the connections will be made.
aPassword - The user's password.
Throws:
java.sql.SQLException

open

public void open(java.lang.String aDriverClass,
                 java.lang.String anUrl,
                 java.lang.String anUser,
                 java.lang.String aPassword)
          throws java.sql.SQLException
Opens the pool.

Parameters:
aDriverClass - Fully qualified name for the JDBC driver.
anUrl - A database url of the form jdbc:subprotocol:subname.
anUser - The database user on whose behalf the connections will be made.
aPassword - The user's password.
Throws:
java.sql.SQLException

borrowConnection

public java.sql.Connection borrowConnection()
                                     throws java.sql.SQLException
Borrows a connection from the pool.

Returns:
A connection to the database.
Throws:
java.sql.SQLException

returnConnection

public void returnConnection(java.sql.Connection aConnection)
                      throws java.sql.SQLException
Returns a connection to the pool.

Parameters:
aConnection - A connection previously borrowed from the database.
Throws:
java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Closes the pool. Closes all open connections, even those not returned to the pool.

Throws:
java.sql.SQLException

isOpen

public boolean isOpen()
Indicates if the pool is open.

Returns:
true if the pool is open; false otherwise.

getPoolInfo

public ConnectionPoolInfo getPoolInfo()
Gets connection pool information.

Returns:
Information about the connection pool.