Chinaunix

标题: [SQL0330] Character conversion cannot be performed. [打印本页]

作者: lvxinzhi    时间: 2014-06-14 11:18
标题: [SQL0330] Character conversion cannot be performed.
用jboss做中间层,数据端端maker,MODIFIER的 CCSID均为1388,在中间层新增数据时,一切正常,但在保存数据时出现以下错误,请问是什么原因?

[SQL0330] Character conversion cannot be performed. Cause . . . . . :   An attempt was made to convert column or host variable *N to column or host variable MODIFIER.  The conversion cannot be performed. If the source data is character and has a mixed Coded Character Set Identifier (CCSID), then double-byte characters were found.  These mixed data conversions are only allowed if the source data does not contain any double-byte data.  If the data is graphic, the CCSID values are not compatible or the string contains single-byte characters. The source CCSID is 937, and the target CCSID is 1388. Recovery  . . . :   Ensure that all character or graphic comparison, concatenation, or assignment is between columns or host variables with compatible CCSID values.  If character data and the source CCSID is mixed, the source data should not contain any double-byte characters. If graphic data, the string cannot contain single-byte characters. Use a casting function like VARCHAR to convert between character, DBCS graphic, and Unicode graphic data.

新增数据的字符集为GBK,通过测试发现,把CCSID改为937,系统会保存成功,但会丢失部分中文

有人给指导一下吗?
作者: mxpy    时间: 2014-06-14 16:34
先把表中原有的数据备份了,再用ALTER TABLE ALTER FIELD 将937的字段改成935或1388,然后将数据恢复回去
作者: lvxinzhi    时间: 2014-06-16 10:21
本帖最后由 lvxinzhi 于 2014-06-17 16:48 编辑

回复 2# mxpy


The source CCSID is 937, and the target CCSID is 1388

这句话说的是数据库中的字符集是1388,
现在要更新的sql 语句里的数据CCSID字符集是937,
在java程序里,并没有指定字符集,后台数据库表中的字段也没有937
这个937是那里来的?

   
作者: lvxinzhi    时间: 2014-06-18 08:30
本帖最后由 lvxinzhi 于 2014-06-18 08:43 编辑

问题已经解决
参考:http://blog.chinaunix.net/uid-200142-id-4308738.html


Server property Description Required ChoicesDefault
package ccsid Specifies the character encoding to use for the SQL package and any statements sent to the server. "1200" (UCS-2)
    "13488" (UTF-16)
no13488







欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2