報錯全文: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與數據庫衝突了,結果一改就行了。