Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.neoworks.connectionpool
Class ConnectionPool

    java.lang.Object
      |
      +--com.neoworks.connectionpool.ConnectionPool

public class ConnectionPool
extends java.lang.Object

Class to represent and manage a pool of database connections. Connections may be used and then released as required, enabling a small number of connections to service a large number of database operations from different

Author:
  Nick Vincent (nick@neoworks.com)

Constructor Summary
`ConnectionPool(java.lang.String name, java.lang.String URL, java.lang.String user, java.lang.String password, int maxConns, int initConns, int timeOut)` Public constructor

Method Summary
`void` | `freeConnection(java.sql.Connection conn)` Return a Connection to the pool.
`java.sql.Connection` | `getConnection()` Get a connection from the pool.
`void` | `release()` Release all free database connections.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ConnectionPool

    public ConnectionPool(java.lang.String name,
                          java.lang.String URL,
                          java.lang.String user,
                          java.lang.String password,
                          int maxConns,
                          int initConns,
                          int timeOut)

  Public constructor

Parameters:
  `name` - The name of this connection pool
  `URL` - The database URL
  `user` - The database username
  `password` - The database password
  `maxConns` - The maximum number of database connections to open
  `initConns` - The initial number of database connections to open
  `timeOut` - The maximum time for a client to wait for a connection from the pool

Method Detail

### getConnection

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

  Get a connection from the pool.

  Returns:
    The next available Connection
  Throws:
    `java.sql.SQLException` - If the request for a connection times out or fails.

### freeConnection

    public void freeConnection(java.sql.Connection conn)

  Return a Connection to the pool.

  Parameters:
    `conn` - The Connection to free

### release

    public void release()

  Release all free database connections.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD