1.0

Table Of Contents
/** a standard JDBC ResultSet. It maintains a
* cursor that points to the current row of data. The cursor
* moves down one row each time the method next() is called.
* You can scroll one way only--forward--with the next()
* method. When auto-commit is on, after you reach the
* last row the statement is considered completed
* and the transaction is committed.
*/
System.out.println( "last name" + "," + "first name" + ":
earnings");
/* here we are scrolling through the result set
with the next() method.*/
while (rs.next()) {
// processing the rows
String firstnme = rs.getString("FIRSTNME");
String lastName = rs.getString("LASTNAME");
BigDecimal salary = rs.getBigDecimal("SALARY");
BigDecimal bonus = rs.getBigDecimal("BONUS");
BigDecimal comm = rs.getBigDecimal("COMM");
System.out.println( lastName + ", " + firstnme + ": "
+ (salary.add(bonus.add(comm))));
}
rs.close();
// once we've iterated through the last row,
// the transaction commits automatically and releases
//shared locks
s.close();
Updatable Result Sets
You update result sets in vFabric SQLFire by using result set update methods (updateRow(),deleteRow()
and insertRow()), or by using positioned update or delete queries. SQLFire supports updatable result sets
that are both scrollable and non-scrollable (forward-only).
To use the result set update methods, the concurrency mode for the result set must be
ResultSet.CONCUR_UPDATABLE. The query does not need to contain FOR UPDATE to use these methods.
Updatable cursors lock the current row with an update lock when positioned on the row, regardless of isolation
level. Therefore, to avoid excessive locking of rows, only use concurrency mode
ResultSet.CONCUR_UPDATABLE or the FOR UPDATE clause when you actually need to update the rows.
If the query that was executed to create the result set is not updatable, SQLFire downgrades the concurrency
mode to ResultSet.CONCUR_READ_ONLY, and adds a warning about this on the ResultSet. The
compilation of the query fails if the result set contains a FOR UPDATE clause but cannot be updatable.
Positioned updates and deletes can be performed if the query contains FOR UPDATE or if the concurrency mode
for the result set is ResultSet.CONCUR_UPDATABLE.
Requirements for Updatable Result Sets
Only specic SELECT statements- simple accesses of a single table-allow you to update or delete rows as you
step through them.
For more information, see SELECT on page 485 and FOR UPDATE Clause on page 489.
vFabric SQLFire User's Guide162
Developing Applications with SQLFire