Previous Topic: CA IDMS Result SetsNext Topic: HibernateDialect


Positioned Updates

The JDBC driver supports positioned updates and deletes in dynamic SQL, when connected to a CA IDMS r14.0 or later system. For prior releases, the ResultSet setCursorName and getCursorName methods are implemented only to conform to the JDBC specification, and are not used internally.

To use positioned updates and deletes, you must specify the FOR UPDATE clause in the SQL query statement as follows:

SELECT ... FROM ... WHERE ... FOR UPDATE [OF column-name...]

If only a subset of the columns in the result set needs to be updated, it is advisable to use the "OF column-name..." clause. Otherwise, CA IDMS/DB uses an area sweep to read the table, even when the table is indexed.

To optimize performance, the JDBC driver usually attempts to fetch more than one row at a time. Because row currency is at the last row, issuing a positioned update or delete would not have the expected effect. Specifying the FOR UPDATE clause or setting a cursor name using setCursorName(String) directs the driver to fetch one row at a time.

In general (to improve performance), we recommend that you turn auto-commit OFF when using Positioned Updates. CA IDMS discards all prepared statements when the transaction is committed. When auto-commit is enabled, you need to prepare statements each time they are executed. An application can avoid this overhead by either: