//Clob转字符串
private String ClobToString(Clob clob) {
if(clob == null){
return “”;
}
String clobStr = “”;
Reader is = null;
if(clob != null){
try {
is = clob.getCharacterStream();
// 得到流
BufferedReader br = new BufferedReader(is);
String s = null;
s = br.readLine();
StringBuffer sb = new StringBuffer();
// 执行循环将字符串全部取出赋值给StringBuffer,由StringBuffer转成String
while (s != null) {
sb.append(s);
s = br.readLine();
}
clobStr = sb.toString();
} catch (IOException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
return clobStr;
}
//字符串转Clob
Clob requestClob = Hibernate.createClob(jsonStr);
Clob转字符串
于 2022-06-15 15:09:20 首次发布