SerializableClob转String

ORACLE数据库读取CLOB字段,JAVA中获取到类型为SerializableClob,如何转换成String类型那?
以下是代码示例:
        SerializableClob sc = (SerializableClob)obj;
        char[] buffer = null;
try {
            //根据CLOB长度创建字符数组
    buffer = new char[(int)sc.length()];
            //获取CLOB的字符流Reader,并将内容读入到字符数组中
    sc.getCharacterStream().read(buffer);
} catch (Exception e) {
e.printStackTrace();
}
        //转换为字符串
        String str = String.valueOf(buffer);

你可能感兴趣的:(java,oracle)