Reduce network traffic

The two environment variables OPTOFC and IFX_AUTOFREE can be used to reduce network traffic when you close Statement and ResultSet objects.

Set OPTOFC to 1 to specify that the ResultSet.close() method does not require a network round trip if all the qualifying rows have already been retrieved in the clients tuple buffer. The database server automatically closes the cursor after all the rows have been retrieved.

HCL OneDB™ JDBC Driver might or might not have additional rows in the clients tuple buffer before the next ResultSet.next() method is called. Therefore, unless HCL OneDB JDBC Driver has received all rows from the database server, the ResultSet.close() method might still require a network round trip when OPTOFC is set to 1.

Set IFX_AUTOFREE to 1 to specify that the Statement.close() method does not require a network round trip to free the database server cursor resources if the cursor has already been closed in the database server.

You can also use the setAutoFree(boolean flag) and getAutoFree() methods to free database server cursor resources. For more information, see The Auto Free feature.

The database server automatically frees the cursor resources after the cursor is closed, either explicitly by the ResultSet.close() method or implicitly by the OPTOFC environment variable.

When the cursor resources have been freed, the cursor can no longer be referenced.

For examples of how to use the OPTOFC and IFX_AUTOFREE environment variables, see the autofree.java and optofc.java demonstration examples described in Sample code files. In these examples, the variables are set with the Properties.put() method.

For more information about setting HCL OneDB environment variables, see HCL OneDB JDBC Driver properties.