JDBC数据库操作类出问题了 第一次遇到

来源:百度知道 编辑:UC知道 时间:2024/05/21 08:50:48
Save could not be completed.
Reason:
Some characters cannot be mapped using "Cp1252" character encoding Either change the encoding or remove the characters which are not supported by the "Cp1252" character encoding

不知道你用的是什么数据库,应该是字符集的问题。以SYBASE为例,JDBC链接时指定字符集,使之与数据库的字符集相同。jdbc:sybase:Tds:192.168.3.119:5000/bzdb?charset=cp936

public Connection mycon = null;
SQLserver 2000
jstl jdbc
....
new net.sourceforge.jtds.jdbc.Driver();
.......

"jdbc:jtds:sqlserver://localhost:1433/DB";
mycon = DriverManager.getConnection(url, "sa", "");

字符集问题,明星你使用的字符集是“Cp1252”;最好把它改为“utf-8”,那问题就解决了。