最新下载
热门教程
- 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;
}
相关文章
- 幻兽帕鲁饲料箱怎么做 饲料箱制造方法介绍 07-31
- 燕云十六声天泉地位怎么晋升 天泉门派晋升方法 07-31
- 明末渊虚之羽龟纽金宝有什么用 龟纽金宝用途介绍 07-31
- 幻兽帕鲁怎么去掉无用词条 去掉无用词条方法介绍 07-31
- 人渣SCUM未安装EasyAntiCheat启动错误如何解决 解决方法一览 07-31
- 明末渊虚之羽羽族遗骸有什么用 羽族遗骸获取位置介绍 07-31