title: inserting data into database using jdbc
body: <p>I have a java Desktop application. 
  I am trying to insert data from two text field  in to Database.
  But getting some runtime error. 
  Help me to resolve it.</p>
  
  <p>Here is my code snippet</p>
  
  <pre><code>final String s1 = t1.getText();
  final String s2 = t2.getText();
  jb.addActionListener(new ActionListener() {
  
      public void actionPerformed(ActionEvent e) {
          String host = "jdbc:derby://localhost:1527/Details";
          String uName = "rajil";
          String uPass = "rajil";
          try {
              Connection con = DriverManager.getConnection(host, uName,uPass);
              Statement st = con.createStatement();
              String q1 = "insert into name (name,id) values('" + s1 + "','" + s2 + "')";
              st.executeQuery(q1);
          } catch (SQLException ex) {
              Logger.getLogger(DBConnect.class.getName()).log(Level.SEVERE, null, ex);
          }
      }
  });
  </code></pre>