关于mysql的update语句中可能出现的com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException的一点发现

来源:互联网 发布:sql数据库紧急模式 编辑:程序博客网 时间:2024/06/07 12:01

调试代码:stmt.executeUpdate("update article set rootid = "+ rootId + "where id =" + rootId);   时发现产生了

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id =42' at line 1 错误提示。后来发现只要把where和它之前的”符号之间加个空格就可以了。微笑

0 0