org.apache.ibatis.exceptions.PersistenceException:
Error querying database. 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 ‘order’ at line 1
The error may exist in com/leo/mapper/OrderMapper.xml
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: select * from order;
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 ‘order’ at line 1
今天测试数据库select语句的时候,报错You have an error in your SQL syntax,这句话是sql语句错误,我的查询语句很简单,如下:
按理说这么简单的sql语句应该不存在问题,在mysql里跑了之后发现,原来是我的表名和数据库关键词order冲突
所以把表名order改成 order
即可(`` 符号是键盘左上角的点号,而不是单引号)