【Java获取Oracle中CLOB字段转换成String】

在Java获取Oracle中CLOB字段转换成String的方法寺至如下

  public String ClobToString(Clob clob) throws SQLException, IOException {

  String reString = "";

  Reader is = clob.getCharacterStream();// 得到流

  BufferedReader br = new BufferedReader(is);

  String s = br.readLine();

  StringBuffer sb = new StringBuffer();

  while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING

  sb.append(s);

  s = br.readLine();

  }

  reString = sb.toString();

  return reString;

  }

posted on 2013-09-11 09:29  挖掘者者者  阅读(465)  评论(0编辑  收藏  举报