Class PooledConnection

java.lang.Object
fc.jdbc.PooledConnection
All Implemented Interfaces:
AutoCloseable, Connection, Wrapper

public final class PooledConnection extends Object implements Connection
A poolable Connection that works with the PooledConnectionMgr. Closing this connection marks it as closed and returns it to the pool.

The connection can be retrieved and closed as many times as needed. It is very important that a connection be closed after use (this is true for all connections, pooled or regular).

Typically one does so by saying:

Connection con;
try {
  con = [..get either a pooled or regular connection..]
  ..use..
  con.commit();  //if transactional
  }
catch (SQLException e) {
  con.rollback(); //if transactional
  }
finally {
  con.close();  //always (transactional or not)
  }
Super Important: transactions are not rolled back or committed when close is invoked. You must either commit or rollback the transaction if in transaction mode (ie you have called setAutoCommit(false) on this connection). Returning the connection (via close) back to the pool without committing/rolling-back will keep the prior statements around and those will be committed/rolledback at a later date if commit/rollback is invoked upon retrieving/using the connection again.