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.
The moose likes JDBC and the fly likes Where is the cursor after we execute a query with statement ? 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
Reply Bookmark "Where is the cursor after we execute a query with statement ?" Watch "Where is the cursor after we execute a query with statement ?" New topic
Author

Where is the cursor after we execute a query with statement ?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 550
Hi
Thank you for reading my post.
imagine that you execute a query with stetement something like

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
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
its before the first record
ypu have to move it to first
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
... so the typical loop that precesses a result set looks like:

... 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!