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 by
解决思路:
1:先把mybatis 生成的SQL到数据库中去运行一下。
2:仔细查看你的SQL语句中是否存在mysql关键字
我的问题:
You have an error in your SQL syntax; for the right syntax to use near 'xxx'
可以从这张图上看出来提示说设置参数出现了问题?????那么问题在哪里??对比下面两张图你就懂了
You have an error in your SQL syntax; for the right syntax to use near 'xxx'
You have an error in your SQL syntax; for the right syntax to use near 'xxx'
是我sql写错了 应该是tcpb.state=#{state},我写成了tcpb.state={#state},所以会报设置参数错误。正常的话打印出来的SQL语句是tcpb.state=?

关键字导致的错误:
Caused by: 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 ‘explain = ‘不通过填写原因’,
很快我就定位到explain 那里,然后百度一下explain是不是关键字,果然是。
You have an error in your SQL syntax; for the right syntax to use near 'xxx'
You have an error in your SQL syntax; for the right syntax to use near 'xxx'
一定要注意这个引号是键盘最左上角的那个。

相关文章:

  • 2021-04-25
  • 2021-11-16
  • 2021-06-14
  • 2021-10-20
  • 2021-06-21
  • 2021-04-27
  • 2021-11-22
  • 2021-06-27
猜你喜欢
  • 2021-11-17
  • 2021-11-17
  • 2021-07-29
  • 2021-09-03
  • 2021-04-18
  • 2021-04-09
相关资源
相似解决方案