Mysql Syntax error while inserting from Servlet using preparedstatement

前端 未结 2 975
小蘑菇
小蘑菇 2021-01-20 23:20

I am trying to insert row into table using servlet, while trying to insert using Statement (using insertQuery1 & insertQuery2), it is executing fine but while executing usin

相关标签:
2条回答
  • 2021-01-21 00:05

    remove the statement in prpStmt.execute(insertPrepQuery);

    it must be prpStmt.execute();

    0 讨论(0)
  • 2021-01-21 00:08

    The message shows that the prepared statement is executed as a regular statement. That's because you used

    prpStmt.execute(insertPrepQuery);
    

    instead of

    prpStmt.execute();
    

    or, better,

    prpStmt.executeUpdate();
    

    You already specified the query when preparing the statement. No need to specifying once again when executing it.

    0 讨论(0)
提交回复
热议问题