public String ClobToString(Clob clob){
String reString = "";
Reader is = null;// 得到流
String s = null;
StringBuffer sb = new StringBuffer();
BufferedReader br = null;
try {
is = clob.getCharacterStream();
br = new BufferedReader(is);
s = br.readLine();
while (s != null) {// 执行循环将字符串全部取出付值给StringBuffer由StringBuffer转成STRING
sb.append(s);
try {
s = br.readLine();
} catch (IOException e) {
e.printStackTrace();
}
}
reString = sb.toString();
} catch (SQLException | IOException e) {
e.printStackTrace();
} finally {
try {
if(br!=null){
br.close();
}
if(is!=null){
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return reString;
}
clob大字段转成string字符串
最新推荐文章于 2024-03-19 20:28:31 发布