Why does my "if(rs==null)" condition always evaluate to false after executing a query?
Joe Sam Shirah The driver's executeXXX() methods will always return a ResultSet object unless there was some serious internal problem or error. Therefore the reference to the returned ResultSet is never normally null. The ResultSet can be empty, that is, nothing met the criteria, but the ResultSet object itself still is not null. Instead, the normal way of checking if data was returned is to use the next() method, as if( rs.next() ) or while( rs.next() ), which returns a boolean. For more information, see: ResultSet and the API documentation for java.sql.ResultSet.