日期:2014-05-20  浏览次数:20974 次

JConnect 6.0 连接Sybase数据库,查询结果中文乱码
数据库服务器版本:
BatchFile code
Adaptive Server Enterprise/12.5.4/EBF 13387/P/NT (IX86)/OS 4.0/ase1254/2006/32-bit/OPT/Sat May 20 00:54:28 2006


数据库编码:
BatchFile code
 Character Set = 2, cp850
     Code Page 850 (Multilingual) character set.
 Sort Order = 50, bin_cp850
     Binary ordering, for use with Code Page 850 (cp850).


使用jar包:jconn3.jar

JDBC尝试连接代码
Java code
Class.forName("com.sybase.jdbc3.jdbc.SybDriver");
        Connection conn = DriverManager
                .getConnection(
                        "jdbc:sybase:Tds:serverip:port?ServiceName=dbname&CHARSET=cp850&JCONNECT_VERSION=6",
                        "user", "pass");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery("select * from sometable");


返回后打印记录内容中文为乱码,曾经试过将CHARSET参数设置为utf8、eucgb等等

第一次接触Sybase,帮帮忙,是不是我忽略了什么东西?

------解决方案--------------------
看这个

http://www.80diy.com/home/20041120/09/3570932.html