README for HP Neoview Release 2.4 Service Pack 1
NOTE: Holdable cursors are not currently supported for result sets that are returned by stored
procedure calls.
ANSI holdable cursors are supported by SELECT statements that use one of these transaction
isolation levels:
• READ UNCOMMITTED
• READ COMMITTED
ANSI holdable cursors are not supported by SELECT statements that use the SERIALIZABLE
or REPEATABLE READ transaction isolation level.
ANSI holdable cursors are ASENSITIVE in Neoview SQL, meaning that it is impossible to predict
whether insert, update, or delete operations made to rows in committed transactions in which
the cursor is held open will be visible through the cursor in subsequent transactions before the
cursor is closed. It is also impossible to predict whether the effects of such operations will be
visible through the cursor in the same transaction in which the changes are made.
ANSI Holdable Cursors in JDBC Client Applications
To specify a holdable cursor in a client application that uses the JDBC Type 4 driver, specify
HOLD_CURSORS_OVER_COMMIT as a resultSetHoldability parameter to one of these
Connection methods: createStatement or prepareStatement. For example, this code
creates a PreparedStatementobject that specifies a holdable cursor:
PreparedStatement setSalary =
conn.prepareStatement("UPDATE persnl.employee " +
"SET salary = salary * (1 + (? / 100)) " +
"WHERE empnum = ?",
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY,
ResultSet.HOLD_CURSORS_OVER_COMMIT);
To specify a non-holdable cursor in a JDBC client application, specify
CLOSE_CURSORS_AT_COMMIT as a resultSetHoldability parameter to the
createStatement or prepareStatement method. In Neoview SQL, the default is a
non-holdable cursor.
ANSI Holdable Cursors in ODBC Client Applications
ODBC does not have a standard API for holdable cursors. For client applications that use an
ODBC driver, Neoview SQL has extended the SQLSetStmtAttr API to support the new
SQL_ATTR_CURSOR_HOLDABLE attribute with the values SQL_HOLDABLE or
SQL_NONHOLDABLE. The header file, hpsqlext.h, contains these literal values for holdable
cursors:
#define SQL_ATTR_CURSOR_HOLDABLE -3
#define SQL_NONHOLDABLE 0
#define SQL_HOLDABLE 1
IMPORTANT: The SQLSetStmtAttr call must be made before the statement is prepared for
the cursor to be handled as an ANSI holdable cursor. The value of the
SQL_ATTR_CURSOR_HOLDABLE attribute at prepare time is the value that Neoview SQL uses
during execution.
For example, this code declares an ANSI holdable cursor:
#define SQL_ATTR_CURSOR_HOLDABLE -3
#define SQL_NONHOLDABLE 0
#define SQL_HOLDABLE 1
retCode = SQLAllocStmt(hdbc,&hstmtC1);
New Features for Release 2.4 SP1 9