oracle.sql.CLOB

String check = "";
String sql = "";
con = JdbcUtil.getConnection();
pcheck=con.prepareStatement(check);
psql=con.prepareStatement(sql);

 插入

oracle.sql.CLOB clob = oracle.sql.CLOB.createTemporary(con, false, oracle.sql.CLOB.DURATION_SESSION);
clob.putString(1, sendLog.getFsnr());
psql.setClob(10, clob);

查询

oracle.sql.CLOB clob = (CLOB) rcheck.getClob("fsnr");
System.out.println("clob: "+StringUtil.clobToString(clob));
public static String clobToString(Clob clob) throws Exception{
    String res="";
    if(clob ==null || clob.getCharacterStream() ==null){
        
    }else{
        Reader io=clob.getCharacterStream();
        BufferedReader br=new BufferedReader(io);
        String s=br.readLine();
        StringBuffer sb=new StringBuffer();
        while(s !=null ){
            sb.append(s);
            s=br.readLine();
        }
        res=sb.toString();
    }
    return res;
}

 

你可能感兴趣的:(java)