It's not a secret anymore!*
The moose likes JDBC and the fly likes ResultSet return value for an empty query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet return value for an empty query" Watch "ResultSet return value for an empty query" New topic
Author

ResultSet return value for an empty query

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
When a query is executed and no resutls are found what value is returned to the ResultSet. In other words I need to determine if the ResultSet is empty.
What method do I use
thanks david
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Hi David,
After you have obtained a "ResultSet", for example:

then if that "ResultSet" is 'empty', the first invocation of the "ResultSet" methos "next()" will return 'false', as in:

Hope this answers your question.
Good Luck,
Avi.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet return value for an empty query
 
Similar Threads
JSP what's wrong with following code?
Not getting resultSet from Prepared statement
my query is successfully running in database but it is returning empty resultset in my java program
ResultSet
How to handl Null Values from Database