大虾,我测试一个数据库,只有下面这个程序查询出了正确的信息。
其中查询语句是
System.out.println(new String(rs.getString("NAME"

.getBytes("ISO8859-1"

,"UTF-8"

);
其他的编码方式都不对,这个数据库是不是有什么问题?
import java.sql.*;
public class QueryXX{
public static void main(String args[]){
QueryXX u = new QueryXX();
try{
u.query();
}catch(Exception e){
e.printStackTrace();
}
}
public void query() throws Exception{
Connection cn = null;
Statement st = null;
ResultSet rs = null;
try{
Driver d = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver"

.newInstance();
java.util.Properties props = new java.util.Properties();
props.put("user", "wolf"

;
props.put("password", "grandmother"

;
String strConnectionString = "jdbc

racle:thin:@127.0.0.1:1521:House";
cn = d.connect(strConnectionString, props);
st = cn.createStatement();
rs = st.executeQuery("SELECT name FROM XX"

;
while(rs.next()){
System.out.println(new String(rs.getString("NAME"

.getBytes("ISO8859-1"

,"UTF-8"

);
}rs.close();rs = null;
}catch(Exception e){
e.printStackTrace();
}finally{
try{
if(rs != null) rs.close();
if(st != null) st.close();
if(cn != null) cn.close();
}catch(Exception exception1){}
}
}
}