在xml中sql语句用PageHelper分页插件进行分页时报错:
Cause: 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 ‘LIMIT 10’ at line 1
; bad SQL grammar []; nested exception is 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 ‘LIMIT 10’ at line 1
是结尾分号“;”的原因
mysql数据库连接工具能够识别这个分号,把他当做这句sql语句的结束符,但是在java编译器中就会提前结束这个sql语句,所以会报错,把结尾分号去掉错误就解决了。