You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version

来源:互联网 发布:吉林建筑大学网络接入 编辑:程序博客网 时间:2024/03/29 13:02

今下午一连遇到了俩错误, 都是比较低级的 

只能说是基础不到家, 唉。。。。。。。。。。 

 

ResultSet rs = pstmt.executeQuery(psql); 运行【完】这的时候 会抛出一个异常: 

com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:

You have an error in your SQL syntax;

check the manual that corresponds to your MySQL server version for theright syntax to use near '?' at line 1 

============================================ 

在解决问题的时候 一直围绕着 “参数”-- ? --求解,但是。。。。 

没有留意 executeQuery () 的用法 

executeQuery  一个是不带参数的, 另一个是带参数的:

二者之间的区别

executeQuery () 是  pstmt 中的方法 

executeQuery (sql)  是继承自stmt中的方法

=============================================