Oracle 大文本Clob类型字段插入失败ORA-22275: invalid LOB locator specified

Oracle 大文本Clob类型字段插入失败ORA-22275: invalid LOB locator specified

读取出来的字段属性为Clob类型,转换为String类型,再操作就可以了。
import java.sql.Clob;
import java.io.BufferedReader;
import java.io.Reader;
public static String clobToStr(Clob clob) throws Exception{
    Reader is = clob.getCharacterStream();
    BufferedReader br = new BufferedReader(is);
    String line = br.readLine();
    StringBuffer sb = new StringBuffer();
    while (line != null) {
        sb.append(s);
        line = br.readLine();
    }
    if(br!=null){
        br.close();
    }
    if(is!=null){
        is.close();
    }
    return sb.toString();
}

你可能感兴趣的:(后端技术)