java mysql prepared statement

前端 未结 2 1982
我在风中等你
我在风中等你 2021-01-27 06:39

I\'m trying to do a simple insert into a database with java and its telling me my sql syntax is off. But when I copyed the string I printed out and put it into the sql command i

相关标签:
2条回答
  • 2021-01-27 07:10

    Don't you need a terminating ; on your sql statement. Also you should look into JPA, which will do all this database querying itself

    0 讨论(0)
  • 2021-01-27 07:11

    You're calling the base Statement.executeUpdate(String) method, which has nothing to do with PreparedStatement and simply executes a string of raw SQL.

    You need to call statement.executeUpdate() without parameters to use the derived method n PreparedStatement.

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