Cursors and Result Set Characteristics
Ingres cursors and JDBC result sets both have an associated type specifying that the object is scrollable or forward-only. The JDBC Driver by default opens cursors as forward-only.
A scrollable cursor can be opened by specifying a JDBC result set type of ResultSet.TYPE_SCROLL_INSENSITIVE or ResultSet.TYPE_SCROLL_SENSITIVE when creating the associated statement. Ingres read-only (static) scrollable cursors are insensitive to changes, while updatable (keyset) scrollable cursors are sensitive to changes. Either type can be specified for both read-only and updatable cursors. If the incorrect type is used, the JDBC driver will produce a result set with the correct type and generate a JDBC warning indicating that the result set type was changed.
Ingres cursors and JDBC result sets both have an associated concurrency characteristic specifying that the object is readonly or updatable. The JDBC Driver automatically provides an updatable ResultSet when the associated cursor is updatable. The JDBC readonly/update mode characteristics are used by the Ingres Driver to control the mode of the resulting cursor.
For an updatable cursor, row updates and deletes can be performed using the updatable ResultSet interface or by using a separate JDBC Statement to issue positioned update and delete statements on the cursor. The cursor name needed to issue a positioned update or delete statement can be assigned using the Statement method setCursorName() or obtained by using the ResultSet method getCursorName().
Cursor concurrency can be specified using the FOR READONLY or FOR UPDATE clause in the SELECT statement. The JDBC Driver supports the JDBC syntax SELECT FOR UPDATE (and also SELECT FOR READONLY) and translates this to the correct Ingres syntax.
A cursor is opened as readonly if one of the following is true (listed in descending precedence):
• The SELECT statement contains the FOR READONLY clause.
• The associated statement was created using a Connection method that specified the concurrency as ResultSet.CONCUR_READ_ONLY.
• The connection is readonly (Connection.setReadOnly( true )).
• The connection property cursor_mode is set to 'readonly' (the default setting).
• The connection property cursor_mode is set to 'dbms' and the DBMS Server determines that the cursor cannot be updated.
A cursor is opened as updatable if one of the following is true (listed in descending precedence):
• The SELECT statement contains the FOR UPDATE clause.
• The associated statement was created using a Connection method that specified the concurrency as ResultSet.CONCUR_UPDATABLE and the DBMS Server determines that the cursor can be updated.
• No other readonly condition is true and the DBMS Server determines that the cursor can be updated.
Note: The JDBC Driver does not attempt to force the cursor to be updatable even when the application requests a concurrency of ResultSet.CONCUR_UPDATABLE when creating the associated statement or the connection property cursor_mode is set to ‘update’. In these cases, the cursor will be updatable if the DBMS Server determines that an updatable cursor is possible, otherwise the cursor will be readonly. The JDBC specification requires "graceful degradation" with a warning rather than throwing an exception when a requested concurrency cannot be provided.
Turn Off Bi-directional Updatable Scrollable Cursors
You can use a configuration setting to turn off bi-directional updatable scrollable cursors. All result-sets will be forward-only.
To turn off bi-directional updatable scrollable cursors
Use this command:
java -Dingres.jdbc.scroll.enabled=false App
Or use this alternative method:
1. Put the following line in a property file:
ingres.jdbc.scroll.enabled=false
2. Specify the property file on the command line:
java -Dingres.jdbc.property_file=file App