If a SQL statement is valid and doesn't match anything, JDBC returns an empty result set. This means that rs.next() returns false.
Note that the SQL in your example is not considered valid by most databases. It needs single quotes around the value:
String query="SELECT * FROM Login WHERE username='bhavik'";
Originally posted by Bhavik patel:
I am new to JDBC....
String query="SELECT * FROM Login WHERE username="+"bhavik";
now suppose,if the user name "bhavik" does not exist...
what will be returned by the method stmt.executeQuery(query);?
and i knoew it will be anythingf except null...
what will be returned by rs.next()?