File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes End of recordset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "End of recordset" Watch "End of recordset" New topic

End of recordset

Michael Winner

Joined: Sep 15, 2003
Posts: 4
Please excuse my ignorance, I'm just a humble ASP programmer trying his best to learn JSP.
I'm setting up a database connection (no problem), looking to see if a record exists. If it exists, I need to collect the information, if it doesn't, I need to add a new record. Quite simple actually. In ASP, we would use a line like:
If recordSet.EOF Then
to determine if the recordset is already at the end. Is there something like this in JSP? I have no problem connecting and retrieving information, but I have no clue how to determine if the record exists, and how to add it, if it doesn't.
Thanks for any help!
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60050

Hi Michael, welcome to the ranch!
This question has more to do with JDBC than with JSP per se, so I'm moving it along to that forum for you.
JSP Forum Bartender

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286

Well, there is a method that you use to run through the record set:
This method moves the cursor in the ResultSet and returns a boolean of it's success.
So if you are searching for a specific record:

I am not sure if this is what you are talking about, so let me know if I am on the right track.

GenRocket - A Test Data Generation Platform
Michael Winner

Joined: Sep 15, 2003
Posts: 4
Well, I had no idea that next() could be used in that way. Thanks!
I agree. Here's the link:
subject: End of recordset
Similar Threads
Formatting Dates returned from SQL queries
using gzip to compress results
Newbie needs help - use AJAX to open ASP?
Using a MIDlet to navigate a database recordset
Test to determine if field or method exists