SQLJ with-clause
The with clause specifies a set of one or more attributes for an iterator or a connection context.
Syntax
Description
- holdability
- For an iterator, specifies whether an iterator keeps its position
in a table after a COMMIT is executed. The value for holdability
must be
true
orfalse
. - sensitivity
- For an iterator, specifies whether changes that are made to the
underlying table can be visible to the iterator after it is opened.
The value must be sqlj.runtime.ResultSetIterator.INSENSITIVE, sqlj.runtime.ResultSetIterator.SENSITIVE,
or sqlj.runtime.ResultSetIterator.ASENSITIVE. The default is sqlj.runtime.ResultSetIterator.ASENSITIVE.
For connections to IBM® Informix®, only sqlj.runtime.ResultSetIterator.INSENSITIVE is supported.
- dynamic
- For an iterator that is defined with sensitivity=sqlj.runtime.ResultSetIterator.SENSITIVE,
specifies whether the following cases are true:
- When the application executes positioned UPDATE and DELETE statements with the iterator, those changes are visible to the iterator.
- When the application executes INSERT, UPDATE, and DELETE statements within the application but outside the iterator, those changes are visible to the iterator.
true
orfalse
. The default isfalse
.Db2® on Linux®, UNIX, and Windows systems servers do not support dynamic scrollable cursors. Specify
true
only if your application accesses data on Db2 for z/OS® servers, at Version 9 or later.For connections to IBM Informix, only
false
is supported. IBM Informix does not support dynamic cursors. - updateColumns
- For an iterator, specifies the columns that are to be modified when the iterator is used for a positioned UPDATE statement. The value for updateColumns must be a literal string that contains the column names, separated by commas.
- column-name
- For an iterator, specifies a column of the result table that is to be updated using the iterator.
- Java™-ID
- For an iterator or connection context, specifies a Java variable that identifies a user-defined attribute of the iterator or connection context. The value of Java-constant-expression is also user-defined.
- dataSource
- For a connection context, specifies the logical name of a separately-created DataSource object that represents the data source to which the application will connect. This option is available only for the IBM Data Server Driver for JDBC and SQLJ.
Usage notes
- The value on the left side of a with element must be unique within its with clause.
- If you specify updateColumns in a with element of an iterator declaration clause, the iterator declaration clause must also contain an implements clause that specifies the sqlj.runtime.ForUpdate interface.
- If you do not customize your SQLJ program, the JDBC driver ignores the value of holdability that is in the with clause. Instead, the driver uses the JDBC driver setting for holdability.