1.0

Table Of Contents
Chapter 29
Using Result Sets and Cursors
A result set maintains a cursor, which points to its current row of data. You can use a result set to step through and
process the rows one by one.
In SQLFire, any SELECT statement generates a cursor that can be controlled using a java.sql.ResultSet
object. SQLFire does not support SQL-92's DECLARE CURSOR language construct to create cursors, but it does
support positioned deletes and positioned updates with updatable cursors.
Note: This topic was adapted from the Apache Derby documentation source, and is subject to the Apache
license:
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
Non-updatable, Forward-Only Result Sets
The simplest result set that vFabric SQLFire supports cannot be updated, and has a cursor that moves only one
way, forward.
This example is an excerpt from a sample JDBC application that generates a result set with
a simple SELECT statement and then processes the rows.
Connection conn = DriverManager.getConnection(
"jdbc:sqlfire://myHostName:1527/");
Statement s = conn.createStatement();
s.execute("set schema 'SAMP'");
//note that autocommit is on--it is on by default in JDBC
ResultSet rs = s.executeQuery(
"SELECT empno, firstnme, lastname, salary, bonus, comm "
+ "FROM samp.employee");
161