java 怎么保存Clob对象 5
3个回答
展开全部
数据库查询出来
CLOB clob = (oracle.sql.CLOB)rs.getClob(i);
String sBlob = ClobToString(clob);
row.put(strFieldName, sBlob);
//---------------
/**
*
* 功能:(将clob类型的数据转换为string)
*
* @Title: ClobToString
* @Date: 0521, 2012 17:10:52 PM
* @param clob
* @return 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;
}
CLOB clob = (oracle.sql.CLOB)rs.getClob(i);
String sBlob = ClobToString(clob);
row.put(strFieldName, sBlob);
//---------------
/**
*
* 功能:(将clob类型的数据转换为string)
*
* @Title: ClobToString
* @Date: 0521, 2012 17:10:52 PM
* @param clob
* @return 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;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询