title: SQL query in JSP file pulling variable from VXML file
body: <p>I'm trying to get an SQL query to work within a JSP file. The JSP file is pulled by a VXML file here is my JSP file code:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;%@ page import="java.util.*" %&gt;
  &lt;%@ page import="java.sql.*" %&gt;
  &lt;% boolean success = true; // Always optimistic
   String info = "";
   String schoolname = request.getParameter("schoolname");
   String informationtype = request.getParameter("informationtype");
  
   try {
          Class.forName("org.postgresql.Driver");
          String connectString = "jdbc:postgresql://localhost:5435/N0176359";
          String user = "****";
          String password = "*****";
          Connection conn = DriverManager.getConnection(connectString, user, password);
          Statement st = conn.createStatement();
    ResultSet rsvp = st.executeQuery("SELECT * FROM lincolnshire_school_information_new WHERE school_name=\'"+schoolname+"\'");
          rsvp.next();
         info = rsvp.getString(2);
   }catch (ClassNotFoundException e) {
           success = false; // something went wrong
   }
  %&gt;
  </code></pre>
  
  <p>As you can see I'm trying to insert the value of the variable declared as "schooname" into the end of the SQL query. However when I come to run the jsp file it doesn't work and I get an error "ResultSet not positioned properly". When I put a standard query in (without trying to make it value of the variable it works fine)</p>
  
  <p>Hope that makes sense, and thank you for any help!</p>