title: DBUtils - using ResultSetHandler
body: <p>I am trying to use ResultSetHandler to pass List of students to a servlet but getting below error</p>
  
  <pre><code>java.lang.NumberFormatException: For input string: "id"
  at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  </code></pre>
  
  <p>the method in Student class is </p>
  
  <pre><code>          public List&lt;Student&gt; list2() throws SQLException {
            Connection connection = null;
            List&lt;Student&gt; studentList = null;
             try {
              Context initCtx = new InitialContext();
              Context envCtx = (Context) initCtx.lookup("java:comp/env");
              DataSource ds = (DataSource)
                envCtx.lookup("jdbc/TestDB");
               connection = ds.getConnection();
  
               ResultSetHandler h = new ArrayListHandler();
  
                QueryRunner run = new QueryRunner(ds);
  
                String sql = "select student_id, student_name from tbl_student";
  
                studentList = (List&lt;Student&gt;)run.query(sql, h);
  
  
            }catch(SQLException sqle) {
                sqle.printStackTrace();
            }
  
            catch(Exception e) {
                e.printStackTrace();
            }
  
            finally {
                DbUtils.closeQuietly(connection);
            }
  
            return studentList;
        }
  </code></pre>
  
  <p>the alternative method where i am not using DButils is working fine .</p>
  
  <pre><code>      public List&lt;Student&gt; list() throws SQLException {
              Connection connection = null;
              Statement statement = null;
              ResultSet resultSet = null;
              List&lt;Student&gt; studentList = new ArrayList&lt;Student&gt;();
  
              try {
                Context initCtx = new InitialContext();
                Context envCtx = (Context) initCtx.lookup("java:comp/env");
                DataSource ds = (DataSource)
                  envCtx.lookup("jdbc/TestDB");
                 connection = ds.getConnection();
                  statement = connection.createStatement();
                  resultSet = statement.executeQuery("select student_id, student_name from tbl_student");
                  while (resultSet.next()) {
                      Student student = new Student();
                      student.setId(resultSet.getInt("student_id"));
                      student.setName(resultSet.getString("student_name"));
                      studentList.add(student);
                  }
              }catch(SQLException e) {
                  e.printStackTrace();
              }
  
              catch(Exception e) {
                  e.printStackTrace();
              }
  
              finally {
                  if (resultSet != null) try { resultSet.close(); } catch (SQLException logOrIgnore) {}
                  if (statement != null) try { statement.close(); } catch (SQLException logOrIgnore) {}
                  if (connection != null) try { connection.close(); } catch (SQLException logOrIgnore) {}
              }
  
              return studentList;
          }
  </code></pre>
  
  <p>How can i solve this?</p>