MyBatis 读取clob格式字段 返回Map,get到的数据oracle.sql.CLOB
Clob columnClob = (Clob) map.get("column");
public String ClobToString(Clob clob) throws SQLException, IOException {
String ret = "";
Reader read= clob.getCharacterStream();
BufferedReader br = new BufferedReader(read);
String s = br.readLine();
StringBuffer sb = new StringBuffer();
while (s != null) {
sb.append(s);
s = br.readLine();
}
ret = sb.toString();
if(br != null){
br.close();
}
if(read != null){
read.close();
}
return ret;
}