环境:hibernate3.1 + mysql4.1 + mysql-connector-java-3.0.11-stable-bin.jar驱动
当将mysql的默认字符集设置成default-character-set=gbk,插入中文字符时出现
例子:
Hibernate: insert into book (bookpagenum, published, bookname, bookauthor) values (?, ?, ?, ?)
could not bind value '待插入的中文字符' to parameter: 2; String index out of range: 9
这是mysql的mysql-connector-java-3.0.11-stable-bin.jar驱动问题。更换驱动就好了
(比如:mysql-connector-java-3.1.13-bin.jar)
posted on 2006-06-30 11:47
想飞的鱼 阅读(2408)
评论(2) 编辑 收藏 所属分类:
hibernate