title: JSP database access not working
body: <p>I am trying to retrieve mysql data in a jsp page.The problem I am facing is the retrieved values are not getting printed. But hello is printed correctly based on number of rows in the table</p>
  
  <p>The code is</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
   &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
      &lt;title&gt;JSP Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Hello World!&lt;/h1&gt;
    &lt;%@page import="java.sql.*,javax.servlet.*,javax.sql.*" %&gt;
    &lt;%
  
        //Register JDBC driver
          Class.forName("com.mysql.jdbc.Driver");
        //Open a connection
           Connection conn=null;
           conn = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/quiz","root","root");
          // Execute SQL query
          Statement stmt = conn.createStatement();
          String sql="select Question_Id,Question from question_master;";
          out.println(sql);
          ResultSet rs=stmt.executeQuery(sql); 
          while(rs.next())
          {
              out.println("hello");
              int id=rs.getInt("Question_Id");
              String ques=rs.getString("Question");
              System.out.println("ID: " + id + "&lt;br&gt;");
              System.out.println("Question " + ques+ "&lt;br&gt;");
          }
        %&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>