why the result is different ,one is query in pl/sql,one is call query sql by java as below,please help,how can i get the same result by java as pl/sql
select utl_raw.cast_to_varchar2('3639bfb79ed95164c86c600039caa1747bf869598b5028d3338bd9b803e1b1fc') from dual;
pl/sql result :69糠炠Qd萳`
java: 69糠炠Qd萳` 9省t{鴌Y婸(�3嬞�岜�
java code :
package com.sf.springboot.test2;
import java.sql.*;
import java.util.Properties;
public class Main {
public static void main(String[] args) throws SQLException {
String url = "jdbc:oracle:thin:@ASCMS.dbsit.sfcloud.local:1521:ascmssit";
String url2 = "jdbc:oracle:thin:@//ASCMS.dbsit.sfcloud.local:1521/ascmssit";
String username = "";
String password = "";
Properties props = new Properties();
props.setProperty("user",username);
props.setProperty("password",password);
props.setProperty("characterEncoding", "AMERICAN\_AMERICA.ZHS16GBK");
try (Connection conn = DriverManager.getConnection(url,username,password)) {
String sql = "select utl\_raw.cast\_to\_varchar2('3639bfb79ed95164c86c600039caa1747bf869598b5028d3338bd9b803e1b1fc') from dual";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
System.out.println(new String(rs.getBytes(1), "GBK"));
System.out.println(rs.getString(1));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}