当前位置: 首页 >数据库 > Mysql报错:MySQLSyntaxErrorException: You have an error in your SQL syntax

Mysql报错:MySQLSyntaxErrorException: You have an error in your SQL syntax

报错全文:

2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: com.mysql.jdbc.exceptions.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 'like,time) values('jack','22','22',0,'Apr 26, 2020')' at line 12020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.Connection.execSQL(Connection.java:3256)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.PreparedStatement.executeInteal(PreparedStatement.java:1313)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1585)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1500)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1485)2020-04-27 10:44:56.541 2029-2098/com.example.teamproject W/System.err: at com.example.teamproject.Dao.insertSheQu(Dao.java:121)2020-04-27 10:44:56.542 2029-2098/com.example.teamproject W/System.err: at com.example.teamproject.FaBu$1$1.run(FaBu.java:99)2020-04-27 10:44:56.542 2029-2098/com.example.teamproject W/System.err: at java.lang.Thread.run(Thread.java:764)

根据提示可以发现是语法错误,由一下几种情况

  1.插入的数据类型不匹配,例如表中属性为Date类型,但是插入的数据为字符串,只要改一致就可以。

  2.另外就可能是sql语句错误

  3.这个就是我新发现的,昨天晚上也没解决,然后把sql语句放到sqlyog并将?代替为具体的数据执行,发现还是错的,然后就思考是不是

near 'like,time中的like与数据库冲突了,结果一改就好了。

作者:printf();
来源链接:https://www.cnblogs.com/songboran/p/12785406.html

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaclub.cn/database/117479.html

标签:SQL_syntax
分享给朋友:

“Mysql报错:MySQLSyntaxErrorException: You have an error in your SQL syntax” 的相关文章