数据库字符集是cp936
ResultSet rsPNode = sybconnId.Query(sql);
System.out.println(rsPNode.getString("p_txt"));
public ResultSet Query(String sql) { ResultSet rs = null; try { conn = getConnection(); if (conn == null) return null; stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);///就是这一行的变动 rs = stmt.executeQuery(sql); System.out.println("........... Resulset get success"); } catch (SQLException e) { System.err.println("dbBean:executeQuery():" + e.getMessage()); } return rs; }
而且无论用哪种方式都不成|
System.out.println(rsPNode.getString("p_txt")); System.out.println(rsPNode.getString("p_txt").getBytes());// System.out.println(rsPNode.getString("p_txt").getBytes("GB2312"));//3 System.out.println(rsPNode.getString("p_txt").getBytes("ISO8859_1"));//4 System.out.println(new String(rsPNode.getString("p_txt").getBytes()));//5 System.out.println(new String(rsPNode.getString("p_txt").getBytes(),"GB2312"));//6 System.out.println(new String(rsPNode.getString("p_txt").getBytes(),"ISO8859_1"));//7 System.out.println(new String(rsPNode.getString("p_txt").getBytes("GB2312")));//8 System.out.println(new String(rsPNode.getString("p_txt").getBytes("GB2312"),"GB2312"));//9 System.out.println(new String(rsPNode.getString("p_txt").getBytes("GB2312"),"ISO8859_1"));//10 System.out.println(new String(rsPNode.getString("p_txt").getBytes("ISO8859_1")));//11 System.out.println(new String(rsPNode.getString("p_txt").getBytes("ISO8859_1"),"GB2312"));//12 System.out.println(new String(rsPNode.getString("p_txt").getBytes("ISO8859_1"),"ISO8859_1"));//13
将编码改成cp936也还是不行
System.out.println(rsPNode.getString("p_txt").getBytes("cp936"));
………… |