【java执行MySQL语句报错】

报错如下

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 ‘leave values(null,1,’2018-06-16 14:32:48.0’,’2018-06-16 18:32:48.0’,’1’)’ at line 1

这是出错的sql语句。

String sql = "insert into leave values(null,?,?,?,?);";

解决方法

leave在MySQL中是关键字,所以必须在leave旁边加一对“

你可能感兴趣的:(疑难杂症系列解决方法)