|
1 异常
2013-06-06 16:15:58,448 [] ERROR impl.AbstractCommonServiceImpl - terminal client [com.terminal.param.data.EpibolyDataParam,updateByTaskId] sys error
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1366];
--- The error occurred while applying a parameter map.
--- Check the apEpibolyDataSqlMap.updateByTaskId-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Incorrect string value: '\xF0\xA0\x82\x87\xE9\x83...' for column 'no_shoot_Reason' at row 1; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the apEpibolyDataSqlMap.updateApEpibolyDataByTaskId-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: Incorrect string value: '\xF0\xA0\x82\x87\xE9\x83...' for column 'no_shoot_Reason' at row 1
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
at org.springframework.orm.ibatis.SqlMapClientTemplate.update(SqlMapClientTemplate.java:411)
2 查询了数据库的版本
5.1.48-log
3 查询表的编码
utf-8
4 最后找到了一篇帖子
http://www.iyunv.com/database/201305/211707.html
Incorrect string value: '\xF0\xA1\xBF\xA8\xE9\x82...' for column 'last_name'
这个问题出在mysql上,mysql如果设置编码集为utf8那么它最多默认只能支持到3个字节的UTF-8编码,
而4个字节的UTF-8字符还是存在的,这样一来如果你建表的时候用的utf8字符集出异常就理所当然了。
之前遇到过两次
短信备份的时候,用户短信内容里面的一些特殊字符编码会是四位,从ios导入的联系人,lastname里面也可能会有此类字符。
解决方法很简单,修改字段或者表的字符集为utf8mb4。
alter table fnbl_pim_contact_1 modifycolumn `last_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL;
但需要注意的是,字符集utf8mb4在mysql 5.5.3之后才能支持。。。。。。
如下短信中的特殊字符,编码就会达到4。
|
|
|
|
|
|
|