最新下载
热门教程
- 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;
}
相关文章
- 失物招领有限公司公寓浩劫丢失的物品分布位置点 06-27
- 必访app如何添加书源 06-27
- 随缘居官网地址是什么 06-27
- 《HOMM: Olden Era》新手入门技巧与心得 06-27
- 修真高手手游怎么玩 修真高手手游新手入门与进阶玩法攻略 06-27
- 明日方舟终末地 幸运萝卜功能详解与实战应用指南 06-27