關於...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