连接mysql时出现错误:java.sql.SQLException: You have an error in your SQL syntax; 错误怎么解决

来源:百度知道 编辑:UC知道 时间:2024/05/07 13:05:06
用户登陆时出现错误: java.sql.SQLException: 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 '='aa' and password='123456'' at line 1,我的表是user,输入的时候用户名和密码也是user表内的,创建user表的语句是:CREATE TABLE usera (
username VARCHAR(20) NOT NULL,
password VARCHAR(20) NOT NULL,
realname VARCHAR(20) NOT NULL,
PRIMARY KEY (username) );
麻烦大家帮忙看看,是什么错误啊?
谢谢!

插入字符串数据要用单引号

SQL语句写错了~!
请检查你的SQL语句 :near '='aa' and password='123456''

SQL命令有错误,回去好好检查一下,,,,

过滤掉非法字符就OK了。