赞
踩
public String clobToString(Clob clob) throws Exception { String re = ""; Reader is = null; BufferedReader br = null; try { // 得到流 is = clob.getCharacterStream(); br = new BufferedReader(is); String s = br.readLine(); StringBuffer sb = new StringBuffer(); // 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING while (s != null) { sb.append(s); s = br.readLine(); } re = sb.toString(); } catch (Exception e) { e.printStackTrace(); }finally { if (is != null) { is.close(); } if (br != null) { br.close(); } } return re; }
String clobString = clob.getSubString(1, (int) clob.length());
String blobString = new String(blob.getBytes(1, (int) blob.length()),"GBK");
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。