最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
在java里读取大对象数据
时间:2022-07-02 18:20:17 编辑:袖梨 来源:一聚教程网
/**
* 从数据库中提取CLOB类型字段的内容并转换为字符串
* @param rs 数据库ResultSet,含有CLOB类型的字段
* @param clobidx 含有CLOB类型字段在ResultSet中的索引
* @return 取出的字符内容
* @throws SQLException
*/
public static StringBuffer getCLOBContent(ResultSet rs,int clobidx) throws SQLException
{
log.debug("开始获取CLOB内容,index="+clobidx);
oracle.sql.CLOB clobField = ((OracleResultSet)rs).getCLOB(clobidx);
long clen=clobField.length();
char clobArray[] = new char[(int)clen];
int readednum= clobField.getChars(1,(int)clen,clobArray);
StringBuffer sb = new StringBuffer();
sb.append(clobArray);
log.debug("读出的CLOB内容为[ "+sb.toString()+"]");
return sb;
}
* 从数据库中提取CLOB类型字段的内容并转换为字符串
* @param rs 数据库ResultSet,含有CLOB类型的字段
* @param clobidx 含有CLOB类型字段在ResultSet中的索引
* @return 取出的字符内容
* @throws SQLException
*/
public static StringBuffer getCLOBContent(ResultSet rs,int clobidx) throws SQLException
{
log.debug("开始获取CLOB内容,index="+clobidx);
oracle.sql.CLOB clobField = ((OracleResultSet)rs).getCLOB(clobidx);
long clen=clobField.length();
char clobArray[] = new char[(int)clen];
int readednum= clobField.getChars(1,(int)clen,clobArray);
StringBuffer sb = new StringBuffer();
sb.append(clobArray);
log.debug("读出的CLOB内容为[ "+sb.toString()+"]");
return sb;
}
相关文章
- 蚂蚁庄园今日最新答案5.2 05-02
- 蚂蚁庄园今日答案最新2024.5.2 05-02
- 小鸡庄园今天答案2024.5.2 05-02
- 今日小鸡庄园答案2024.5.2 05-02
- 我国哪座名楼有“洞庭天下水,岳阳天下楼”的美誉 蚂蚁庄园今日答案5月2日 05-02
- 旅游小知识:你会辨认海滩安全旗吗?红色旗帜通常代表 蚂蚁庄园今日答案5.2 05-02