DB2 Version 9.7 for Linux, UNIX, and Windows

CursorHold CLI/ODBC configuration keyword

Controls the effect of a transaction completion on open cursors.

db2cli.ini keyword syntax:
CursorHold = 1 | 0
Default setting:
Selected--Cursors are not destroyed.
Equivalent statement attribute:
SQL_ATTR_CURSOR_HOLD
Usage notes:
 
This option controls the effect of a transaction completion on open cursors.
  • 1 = SQL_CURSOR_HOLD_ON, the cursors are not destroyed when the transaction is committed (default).
  • 0 = SQL_CURSOR_HOLD_OFF, the cursors are destroyed when the transaction is committed.
Note: Cursors are always closed when transactions are rolled back.

This option affects the result returned by SQLGetInfo() when called with SQL_CURSOR_COMMIT_BEHAVIOR or SQL_CURSOR_ROLLBACK_BEHAVIOR. The value of CursorHold is ignored if connecting to DB2® Server for VSE & VM where cursor with hold is not supported.

You can use this option to tune performance. It can be set to SQL_CURSOR_HOLD_OFF (0) if you are sure that your application:
  1. Does not have behavior that is dependent on the SQL_CURSOR_COMMIT_BEHAVIOR or the SQL_CURSOR_ROLLBACK_BEHAVIOR information returned via SQLGetInfo(), and
  2. Does not require cursors to be preserved from one transaction to the next.

The DBMS will operate more efficiently with CursorHold disabled, as resources no longer need to be maintained after the end of a transaction.