首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

mysql安插中文

2012-11-10 
mysql插入中文Struts has detected an unhandled exception:Messages:1. Incorrect string value: \xA1\x

mysql插入中文

 Struts has detected an unhandled exception:Messages:    1. Incorrect string value: '\xA1\xAA\xA1\xAA\xB0\xFC...' for column 'content' at row 1   2. Hibernate flushing: Could not execute JDBC batch update; uncategorized SQLException for SQL [insert into blog (comments, content, createdate, description, tid, title, uid, id) values (?, ?, ?, ?, ?, ?, ?, ?)]; SQL state [HY000]; error code [1366]; Incorrect string value: '\xA1\xAA\xA1\xAA\xB0\xFC...' for column 'content' at row 1; nested exception is java.sql.BatchUpdateException: Incorrect string value: '\xA1\xAA\xA1\xAA\xB0\xFC...' for column 'content' at row 1File: com/mysql/jdbc/ServerPreparedStatement.javaLine number: 657


最近在发表文章的时候 却出现了这样的错误。

不知道什么原因 ,在有时插入的时候不会出错  但有时又出错。。

后来发现  原来是mysql的表中字段为gb2312_chinese_ci  而程序中使用的utf-8  这可能是乱码所致。

参考:http://www.java1995.cn/blog/item/17
1 楼 wangking717 2011-11-11   我程序上以及数据库上都是用的UTF8,都出现了这样的问题,所以LZ还是没找到解决的原因。。

热点排行