完整报错信息:

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();

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

  1. [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 ''<h1 style="text-align: center;">php

    [Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL s ...

  2. ERROR: 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 'type=InnoDB' at line 7

    问题: 使用hibernate4.1.1,数据库使用mysql5.1.30,使用hibernate自动生成数据库表时,hibernate方言使用org.hibernate.dialect.MySQLI ...

  3. C# Mysql 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数据了,今天在使用C#访问MySql数据库时出现了一个小插曲. 错误提示: You have an error in your SQL syntax; check the man ...

  4. 遇到的check the manual that corresponds to your MySQL server version for the right syntax错误

    遇到的check the manual that corresponds to your MySQL server version for the right syntax错误. 结果发现是SQL关键 ...

  5. 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

    关于用Power Designer 生成sql文件出现 错误  [Err] 1064 - You have an error in your SQL syntax; check the manual ...

  6. MySQL遇到check the manual that corresponds to your MySQL server version for the right syntax错误

    用MySQL新建了一个Order表,插入了一条数据.总是显示 You have an error in your SQL syntax; check the manual thatcorrespond ...

  7. 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中如果字段使用了关键字,在插入和更新时会提示 You have an error in your SQL syntax; check the manual that corresponds ...

  8. MySQL check the manual that corresponds to your MySQL server version for the right syntax错误

    地化GO的时候一直遇到一个错误就是check the manual that corresponds to your MySQL server version for the right syntax ...

  9. 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 ...

    下面是我update数据库时打印出来的异常: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSynt ...

随机推荐

  1. initramfs打包集成rootfs到image镜像及linux rootfs的正常启动

    最近的项目中需要在仿真机haps及VDK上集成rootfs,中间遇到一些问题,在此整理记录以备忘. rootfs里面集成的busybox版本1.29.3 (buildroot环境中自带) kernel ...

  2. [校内训练19_09_02]A

    题意 给出N 个形如$f_i(x) = a_i x^2 + b_i x $的二次函数. 有Q 次询问,每次给出一个x,询问$max{\{f_i(x)\}}$.$N,Q \leq 5*10^5$. 思考 ...

  3. 基于Flask框架搭建视频网站的学习日志(二)

    基于Flask框架搭建视频网站的学习日志(二)2020/02/02 一.初始化 所有的Flask程序都必须创建一个程序实例,程序实例是Flask类的对象 from flask import Flask ...

  4. Windows环境安装与配置RocketMQ

    1.下载RocketMQ http://rocketmq.apache.org/release_notes/release-notes-4.3.0/ 2.解压下载的安装包rocketmq-all-4. ...

  5. 外网通过frp进行windows远程文件共享

    需求 远程访问位于内网中的文件.例如,家里,公司内. 所需技术 frp windows文件共享 具有公网地址的服务器一台 实现过程 windows文件共享,首先自己在局域网内实现.这不是本文重点. 公 ...

  6. 关于SpringMVC未找到类[No qualifying bean of type [...]is defined]问题

    首先,不要慌,出现这个问题肯定是某一个配置注解没写上.. 无非就几个地方: 1.控制层是否添加@Controller or 需要pring管理的类是否添加@Component 2.DAO层是否添加@R ...

  7. sharding-JDBC学习笔记

    sharding-JDBC学习笔记 ShardingSphere ShardingSphere是一套开源的分布式数据库中间件解决方案组成的生态圈,它由Sharding-JDBC.Sharding-Pr ...

  8. Android 开启与关闭软键盘

    http://www.cnblogs.com/weixing/p/3300908.html InputMethodManager imm = (InputMethodManager)getSystem ...

  9. Java 添加、替换、删除PDF中的图片

    概述 本文介绍通过java程序向PDF文档添加图片,以及替换和删除PDF中已有的图片.另外,关于图片的操作还可参考设置PDF 图片背景.设置PDF图片水印.读取PDF中的图片.将PDF保存为图片等文章 ...

  10. Kafka常用topic操作命令汇总

    offset topic consumer-group consumer producer producer-golang topic 工具 https://cwiki.apache.org/conf ...