title: Table not being updated
body: <p>EDIT: THIS PROBLEM HAS BEEN SOLVED!!</p>
  
  <p>I am working on updating the data on a table. Here's the code:</p>
  
  <pre><code>@Override
  public void UpdateQnsAns(Exam exam, String subject) {
      try {
          String sql = "update table " + subject + "_tbl set question=?, option1=?, option2=?,"
                  + " option3=?, option4=?, answers=? where id=?";
          PreparedStatement pst = new DBConnection().getConnection().prepareStatement(sql);
          pst.setString(1, exam.getQuestion());
          pst.setString(2, exam.getOption1());
          pst.setString(3, exam.getOption2());
          pst.setString(4, exam.getOption3());
          pst.setString(5, exam.getOption4());
          pst.setString(6, exam.getCorrectOption());
          pst.setInt(7, exam.getId());
          pst.executeUpdate();
      } catch (SQLException ex) {
          Logger.getLogger(ExamDaoImpl.class.getName()).log(Level.SEVERE, null, ex);
      }
  }
  </code></pre>
  
  <p>Here I guess the error is being shown at the <code>pst.executeUpdate()</code> as per the glassfish server because the third last line of the error below (com.edu.daoImpl.ExamDaoImpl.UpdateQnsAns(ExamDaoImpl.java:120)) links me to pst.executeUpdate line. The error reads like this:</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'table java_tbl set question='What is the default value of Short variable?', opti' at line 1
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.Util.getInstance(Util.java:386)
  at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120)
  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052)
  at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503)
  at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664)
  at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794)
  at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2458)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2375)
  at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2359)
  at com.edu.daoImpl.ExamDaoImpl.UpdateQnsAns(ExamDaoImpl.java:120)
  at com.edu.defaultServlet.ExamServlet.processRequest(ExamServlet.java:221)
  at com.edu.defaultServlet.ExamServlet.doPost(ExamServlet.java:257)
  </code></pre>