Close the connection
The following table contrasts the different effects of calling the Connection.close() and scrubConnection() methods in environments that use connection pooling and those that do not.
For
more information about deallocating resources, see Deallocate resources. For more information
about the scrubConnection() method, see Clean pooled connections.
Connection pooling status | Effect of calling Connection.close() method | Effect of calling scrubConnection() method |
---|---|---|
Non-connection pool setup | Closes database connection, all associated statement objects, and their result sets. Connection is no longer valid. | Returns connection to original state, keeps opened
statements, but closes result sets Connection is still valid. Releases resources associated with result sets only. |
Connection pool with HCL Informix® Implementation | Closes connection to the database and reopens it to close any statements associated with the connection object and reset the connection to its original state Connection object is then returned to the connection pool and is available when requested by a new application connection. | Returns a connection to original state and keeps
all open statements, but closes all result sets Calling this method in this situation not recommended |
Connection pool with application server implementation | Defined by your connection pooling implementation | Returns connection to original state and retains
opened statements, but closes result sets This functionality can be useful if you are using the JDBC 3.0 feature of statement pooling with connections. When your application calls the Connection.close() method, your application servers connection-pool manager can call scrubConnection() for the pooled connection object before returning the object to the connection pool. |
Important: When calling the scrubConnection() method,
your applications should be using server-only connections.