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

报错全文:java

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 1
2020-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.executeInternal(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)

根据提示能够发现是语法错误,由一下几种状况mysql

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

  2.另外就多是sql语句错误数据库

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

near 'like,time中的like与数据库冲突了,结果一改就行了。
相关文章
相关标签/搜索