title: Inserting Integer Values into MySQL Database using Variables
body: <pre><code>     Class.forName("com.mysql.jdbc.Driver");
       Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test",
       "root", "mysecret");
       System.out.println("Connected to Database");
       Statement stmt1 = conn.createStatement();
       ResultSet rs1=null;
       String sql="insert into id
       values('"+name+"',12,+fs+,+se+,+th+,+ft+,+f+,+si+,+sv+,+ei+)";
       System.out.println("sql:"+sql);
       stmt1.executeUpdate(sql);     
  </code></pre>
  
  <p>The Name Variable is taken care of in the definition part not included here, the output is</p>
  
  <pre><code>     sql:insert into id values('Golum',12,+fs+,+se+,+th+,+ft+,+f+,+si+,+sv+,+ei+);
  </code></pre>
  
  <p>It also says error in SQL Syntax which refers to the variables fs,se,th,ft,f,si,sv and ei. Basically i am trying to pass integers to MySQL Database using variables. the definition of these variables is as such</p>
  
  <pre><code>    int fs = x21;
      int se = y21;
  </code></pre>
  
  <p>x21 and y21 store mouse click co-ordinates x and y respectively. The code below shows that the co-ordinates are passed correctly. The error is in SQL Syntax. I wanna Know what is the correct syntax for passing integers to SQL Database using this technique.</p>
  
  <pre><code>    System.out.println(fs);
  </code></pre>