关于...corresponds to your MySQL server version for the right syntax to use near '?' at line 1的解决办法


完整报错信息:

java.sql.SQLSyntaxErrorException: 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 '?' at line 1

踩坑经历:

在有道词典翻译后,“你的SQL语法有错误;检查手册对应的MySQL服务器版本的正确语法附近'?'在第1行”。这句话的意思是在?附近的SQL语句有错误。当我去看整个SQL语句时,发现SQL语句并没有写错。然后我就觉得应该是PreparedStatement这个类的预编译或编译的方法那出错了,于是我去看了.prepareStatement()和.executeQuery()方法,发现.executeQuery()传入了sql语句,没想到自己还遇到了这种低级的错误。。。

解决方法:

将ppstm.executeQuery(sql);中的sql去掉,改成ppstm.executeQuery();


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '123456' WITH GRANT OPTION' at line 1 Django进行数据迁移时,报错:(1064, "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 '(6) NOT NULL)' at line 1") 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 '"id", ERROR 1064 (42000): 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 解决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 (order_name, customer) MySQL server version for the right syntax to use near 'type=InnoDB' at line 1 Mysql语法错误之> 1064 - 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' MySql 执行语句错误 Err] 1064 - 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 mybatis批量更新update-设置多个字段值 报错 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 错误:MySQL server version for the right syntax to use near
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM