This week's book giveaway is in the
Agile and other Processes
forum.
We're giving away four copies of
The Mikado Method
and have Ola Ellnestam and Daniel Brolund on-line!
See
this thread
for details.
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Databases
»
JDBC
Author
Where is the cursor after we execute a query with statement ?
raminaa niilian
Ranch Hand
Joined: Jul 14, 2005
Posts: 550
posted
Jan 30, 2006 14:05:00
0
Hi
Thank you for reading my post.
imagine that you execute a query with stetement something like
ResultSet rs=st.executeQuery("select * from table1");
where is cursor of rs now ?
is it in first , is yes does first means first record or it is before first record ?
Thank you
[ January 30, 2006: Message edited by: raminaa niilian ]
Thara Visu
Ranch Hand
Joined: May 17, 2005
Posts: 87
posted
Jan 30, 2006 16:31:00
0
I believe its before the first record.
You need to traverse to the first record using rs.next() to get to the first record.
Thara<br />SCJP 1.4 96%<br />SCBCD 1.3 96%
chirs blr
Greenhorn
Joined: Jan 23, 2006
Posts: 1
posted
Feb 02, 2006 05:32:00
0
its before the first record
ypu have to move it to first
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
Feb 02, 2006 06:21:00
0
... so the typical loop that precesses a result set looks like:
while(rs.next()) { String s = rs.getString("..."); ... }
... rather than some freaky do/while loop to
test
at the loop's bottom!
There is no emoticon for what I am feeling!
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Where is the cursor after we execute a query with statement ?
Similar Threads
Help me get started
SQLException : Invalid cursor state
Invalid cursor state?
JTable output from db query
Problem with servlet reading images in database!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter