title: jdbc empty resultset check not working
body: <p>In the following java class i'm having a method authenticate, in which i'm using <code>resultSet.next()</code> method to check that whether the given userName and password exist in the database or not, but it is returning false even when the given userName and password exist in the database.</p>
  
  <pre><code>public boolean authenticate(String userName,String password){
  //db connection code
      try {
        String query = "select user_name from registeredUser where user_name= ? AND password = ?";
        pstmt = conn.prepareStatement(query); 
            pstmt.setString(1, userName);
        pstmt.setString(2, password);
        rs = pstmt.executeQuery();
        if(rs.next()) {  
              System.out.println("True");
                  return true;
            }  
        else return false;
      } catch (Exception e) {
          e.printStackTrace();
          return False;
      } finally {
        try {
          rs.close();
          pstmt.close();
          conn.close();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
  }
  </code></pre>