Re: need cursor info
gk wrote:
RedGrittyBrick wrote:
gk wrote:
How do i retrive those records ?
By using ResultSet.next() and ResultSet.getXXX() on your ResultSet instance;
ok. but these are as simple as extracting values from a ResultSet
Yes.
.....here is no cursor involved .
Wrong.
If anybody can answer these questions or provide me some
resources/links where i could get the answers of these questions...
http://en.wikipedia.org/wiki/Cursor_%28databases%29
oh...ok, i see the wikipedia says ,
"..a cursor can be thought of as an iterator over the collection of
rows in the result set...."
well, but what will i get out of it ?
i can do the same thing like this (without a cursor)
while (rs.next()) {
// Get the data from the row using the column index
String s = rs.getString(1);
// Get the data from the row using the column name
s = rs.getString("col_string");
}
this is also iterating the resultset without a cursor ...right ? so,
Wrong.
why do i use cursor then ?
what benefit cursor will give ?
Yea, do you want to tell , cursor can go backwards in the resultset ? i
am not sure ....or this is a benefit i'll will get from a cursor .
please explain , why and when one should use cursor ?
As Patricia says, read the documentation for the API!
http://javadocs.org/ResultSet
The answer you seek is in the second paragraph:
"A ResultSet object maintains a ...
The next method moves the ..."