Clean pooled connections

You can alter connections from their original, default properties by setting database properties, such as AUTOCOMMIT and TRANSACTION ISOLATION. When a connection is closed, these properties revert to their default values. However, a pooled connection does not automatically revert to default properties when it is returned to the pool.

In HCL OneDB™ JDBC Driver, you can call the scrubConnection() method to:
  • Reset the database properties and connection level properties to the default values.
  • Close open cursors and transactions.
  • Retain all statements.

This now enables the application server to cache the statements, and it can be used across applications and sessions to provide better performance for end-user applications.

The signature of the scrubConnection() method is:
public void scrubConnection() throws SQLException
The following example demonstrates how to call scrubConnection():
try
  {
  IfmxConnection conn = (IfmxConnection)myConn;
  conn.scrubConnection();
  }
catch (SQLException e)
  {
  e.printStackTrace();
  }
The following method verifies whether a call to scrubConnection() has released all statements:
public boolean scrubConnectionReleasesAllStatements()