title: Second SQL query not Inserting any value in database
body: <p>I am trying to insert question in question table and than getting that latest question <code>id</code>. I am trying to add options for it in other table named <code>select_op</code>. It inserts question successfully but not options. Even I am not getting any exception, method exits successfully.</p>
  
  <pre><code>int id=addQuestions(ques, survey_id); 
  
  if(id&gt;0){
      //not inserting anyvalue in database
      String sql = "insert into select_op("+ "first,"+ "second,"+ "third,"+ "four,"+ "question_id)"+" values(?,?,?,?,?)";     
  
      try {
          conn.setAutoCommit(false);
          PreparedStatement pst = conn.prepareStatement(sql);
          pst.setString(1,option1);
          pst.setString(2,option2);
          pst.setString(3,option3);
          pst.setString(4,option4);
          pst.setInt(5,id);
          pst.addBatch();
          System.out.println(pst.executeBatch());
      }catch (BatchUpdateException e) {
          try {
              System.out.println(e);
              conn.rollback();
          } catch (Exception e2) {
              e.printStackTrace();
          }
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p></p>
  
  <pre><code>//this function insert data successfully
  public int addQuestions(String ques,String survey_id){
  
      String sql = "insert into question(question,survey_id) values(?,?)";        
      int id = 0;
      try {
          conn.setAutoCommit(false);
          PreparedStatement pstmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
          pstmt.setString(1,ques);
          pstmt.setString(2,survey_id);
          pstmt.addBatch();           
          pstmt.executeBatch();
          ResultSet keys = pstmt.getGeneratedKeys();  
          keys.next();  
          id = keys.getInt(1);  
          keys.close();  
          conn.commit();
          pstmt.close();
      }
      catch (BatchUpdateException e) {
          try {
              conn.rollback();
          } catch (Exception e2) {
              e.printStackTrace();
          }
      } catch (Exception e) {
          e.printStackTrace();
      }
      return id;
  }
  </code></pre>
  
  <p>Any Suggestion?</p>