title: what this error denotes java.sql.SQLException: Column Index out of range, 3 > 1
body: <pre><code>String sess_user = session.getAttribute("userid").toString();
  out.println(sess_user);
  try{  
        String connectionURL = "jdbc:mysql://localhost:3306/books";// books is the database  
        Connection connection = null;
        Class.forName("com.mysql.jdbc.Driver");  
        connection = DriverManager.getConnection(connectionURL, "root", "bonnysingh");  
  
        Statement st = connection.createStatement();
        ResultSet rs=st.executeQuery("select email from signup where UserName = '" + sess_user +"'");
            while(rs.next()){
            userEmail = rs.getString(3);
            }
  }
      catch(Exception ee){
  
          out.println(ee);
      }
  out.println("Hello");
  out.println(userEmail);
  </code></pre>
  
  <p>The output of userEmail is always null. I don't know what the problem here.but i think while(rs.next()) loop is not executing properly. Can anyone tell me whats the error?</p>