create table if not exists usertable ( staffID char(10) not null primary key, staffName char(16) not null default '', password char(20) not null default '', Department char(20) not null default '', optKind int not null default 0, particular varchar(255) not null default '' ) type=InnoDB;insert into userstable (staffid,staffname,password,Department,optkind,particular) values ("Admin","DBM","admin","Mamanger DBM",0,"数据库管理"); 我的可以啊
我也有这个问题 jdk1.5+tomcat5.5.12+mysql5 在query browser中插入没问题,但是在jsp里就有问题,调试信息:com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'class_name' at row 1没办法,也在发愁:(
我解决能插入的问题
可是显示的是问号
方法:
修改my.ini文件
字符集为 关闭312
-> `comname` char(10) NOT NULL,
-> PRIMARY KEY (`comname`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=gb2312;
Query OK, 0 rows affected (0.23 sec)mysql> INSERT INTO `test` (comname) VALUES ('上海市');
Query OK, 1 row affected (0.09 sec)mysql> select * from test;
+---------+
| comname |
+---------+
| 上海市 |
+---------+
1 row in set (0.01 sec)mysql> drop table test;
Query OK, 0 rows affected (0.11 sec)
(
staffID char(10) not null primary key,
staffName char(16) not null default '',
password char(20) not null default '',
Department char(20) not null default '',
optKind int not null default 0,
particular varchar(255) not null default ''
) type=InnoDB;insert into userstable
(staffid,staffname,password,Department,optkind,particular)
values
("Admin","DBM","admin","Mamanger DBM",0,"数据库管理");
我的可以啊
不知道大家用编程软件连接数据库之后还能成功不?
比如delphi
现在郁闷死
jdk1.5+tomcat5.5.12+mysql5
在query browser中插入没问题,但是在jsp里就有问题,调试信息:com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'class_name' at row 1没办法,也在发愁:(
在matrix上找到的解决方法:http://www.matrix.org.cn/thread.shtml?topicId=28009&forumId=38
我大体是按照第11楼那哥们的说法做的,然后就是第13楼兄弟字符串转换的做法我把页面编码和数据库字符集都设成utf8,这样这需要在存储的时候将要存储的字符串转换成utf8就行了。