title: Connecting jsp to database
body: <p>I have designed a jsp page from which i am passing the field values to another jsp page.. In this page, I want to store the values in a database and display appropriate messages according to success or failure in this page. Everything seems to work correctly except that the data does not get inserted into the database and no error maessages are displayed.  </p>
  
  <hr>
  
  <p>students.jsp</p>
  
  <pre><code>&lt;form id="form" method="post" action="students_final.jsp"&gt;
    Student name:&lt;input type="text" value="" name="name"&gt;
    Reg no:&lt;input type="text" value="" name="regno"&gt;
    &lt;input type="submit" value="Register" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <hr>
  
  <p>students_final.jsp</p>
  
  <pre><code>&lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;%@page language="java"%&gt;
  &lt;%@page import="java.lang.*" import="java.sql.*"%&gt;
  
  &lt;% 
    try {
      Class.forName("com.mysql.jdbc.Driver");  
      String url="jdbc:mysql://localhost:3306/userdbase";
      Connection connection = DriverManager.getConnection(url, "root", "passwd");  
  
      String name=request.getParameter("name");
      String regno=request.getParameter("regno");
  
      "INSERT INTO `schooldatabase`.`test` (`name`) VALUES ('" + name + "');";
      Statement st= connection.createStatement();
      int count=st.executeUpdate(strquery);
  
      /*ResultSet rs= st.executeQuery(strquery);*/
    }
    catch(Exception e)
    {
      System.out.println("Could not connect");
    }
  %&gt;
  </code></pre>
  
  <p>I know there is a very silly mistake. Please help me find it !!</p>