If you close the connection directly the pool will still have a reference to the Connection because it has not been released, so while the Connection will close its resources, the Pool will retain the reference and you'll probably be leaking memory over time.
The suggested way to deal with this is when you obtain a Connection from the Pool, wrap it using DelegatingConnection:
public final class PooledConnection extends DelegatingConnection {
private final ConnectionPool mPool;
public PooledConnection(final Connection theConnection, final ConnectionPool thePool) {
super(theConnection);
mPool = thePool;
}
@Override
public void close() {
super.close();
mPool.release(getConnection());
}
}
This way you can simply close the Connection in the code that uses it and it will correctly release back into the pool and you don't have to worry about passing around the reference to the pool.