zoukankan      html  css  js  c++  java
  • 关于...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();

  • 相关阅读:
    HDOJ 1846 Brave Game
    并查集模板
    HDU 2102 A计划
    POJ 1426 Find The Multiple
    POJ 3278 Catch That Cow
    POJ 1321 棋盘问题
    CF 999 C.Alphabetic Removals
    CF 999 B. Reversing Encryption
    string的基础用法
    51nod 1267 4个数和为0
  • 原文地址:https://www.cnblogs.com/windowsxpxp/p/12210636.html
Copyright © 2011-2022 走看看