myeclipse+mysql6.0insert into users values('用户名','123');在程序中出错,把值改成英文则可正常插入记录。
错误提示为:
Syntax error or access violation, message from server: "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"用过滤器把网站全设成utf-8,按网上教的方法,已经在my.ini设置默认字符为utf-8。建库:
CREATE DATABASE IF NOT EXISTS car default charset utf8 COLLATE utf8_general_ci;
建表:
create table users
(
id varchar(32) not null primary key,
password varchar(20) not null
)ENGINE=myisam default charset utf8;
错误提示为:
Syntax error or access violation, message from server: "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"用过滤器把网站全设成utf-8,按网上教的方法,已经在my.ini设置默认字符为utf-8。建库:
CREATE DATABASE IF NOT EXISTS car default charset utf8 COLLATE utf8_general_ci;
建表:
create table users
(
id varchar(32) not null primary key,
password varchar(20) not null
)ENGINE=myisam default charset utf8;
在命令行是可以的,插入数据与查询都正常。用statement.executeUpdate()执行就会出错。
不要单纯的将GB2312的JSP文件中的GB2312改成UTF-8的,无效的操作很复杂。。2.如果不想像上面那样麻烦,,那就只有不改JSP的编码,而从数据库的编码和过滤器的编码上着手了,祝你幸运。