Possible Duplicate:
How to check if resultset has one row or more?
What will executeQuery(String sql) return when the result of the SQL Query is zero rows>? If it returns a ResultSet Object, how will we detect that the SQL Query has returned nothing.
Assume the SQL Query to be a SELECT statement.
Did you check ResultSet’s next method . Initially the ResultSet’s cursor points to before the first row, the very first call to next() returns false implies there was no data in the ResultSet. See How do I get the size of a ResultSet? , since there is no direct size() or length() method for Resultsets in Java.