Databases Reference
In-Depth Information
Table 5-3 Comparison between ResultSet and iterator
Description
ResultSet object
Iterator
Creation
Returned by Statement object
methods executeQuery.
For example,
ResultSet rs=null;
rs=stmt.executeQuery(query
)
where stmt is the statement
object.
Need to declare the iterator class
using SQLj declaration clause.
Create the object after declaration.
For example:
#sql iterator iterator1(int, String);
iterator iterator1
Scrollability and
Updatability
Scrollability and Updatability
are defined while creating the
Statement object for all the
ResultSets created from that
object.
Scrollability and Updatability are
defined by specifying the
implement clause in the
corresponding interface while
declaring the iterator.
Holdability
Same as above.
Holdability is defined by defining
the holdability property to true in
the with clause of the iterator.
Methods
supported for
scrollability
first
last
previous
next
absolute
relative
afterLast
beforeFirst
first
last
previous
next
absolute
relative
afterLast
beforeFirst
5.13 Running the application
The application code in Example 5-1 on page 202 can be executed either
stand-alone or using a Web service.
5.13.1 Running an application stand-alone
To run the application stand-alone, follow these steps:
1. Set your CLASSPATH to include all the files required for JDBC (see
“Application requirements” on page 200).
2. Initialize the following variables in the main method:
a. custid: Initialize the variable with a valid customer ID ( Exists in customer
table).
 
Search WWH ::




Custom Search