JDBC抛com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException异常的的问题

Exception in thread “main” 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=4’ at line 1

刚遇到这个问题的时候检查了一下代码发现没有错误,百度后说是拼写错误,于是我一个一个检查拼写,发现仍然没错
经过查找资料,发现是数据库语句问题:必须要加空格如下图:
有错误的代码:
在这里插入图片描述
在这里插入图片描述
修改后的代码:(红色箭头即为要加的空格)
在这里插入图片描述
运行控制台没有错误产生
在这里插入图片描述
在这里插入图片描述
成功更新
在这里插入图片描述

发布了8 篇原创文章 · 获赞 13 · 访问量 232

猜你喜欢

转载自blog.csdn.net/weixin_44228113/article/details/104026083