something about WebRowSet

yatwql 2001-09-06 05:21:26
我想由DB的store procedure中取得一个结果集合,然后要把取到的的ResultSet给塞到一个WebRowSet里面,以脱离Connection来操作这个结果集合。
但是发现运行populate操作的时候,会抛出NullPointerException,而经过测试
所拿到的ResultSet是非空的.

public static sun.jdbc.rowset.WebRowSet testmethod(){
Connection conn = null ;
CallableStatement cstmt = null ;
String str = null ;
ResultSet result = null ;
str = "{?=call test2.get_resultset()}" ;
try
{
conn = DbPool.getConnection() ;
cstmt = conn.prepareCall(str) ;

cstmt.registerOutParameter(1, OracleTypes.CURSOR);
cstmt.execute();
result = (java.sql.ResultSet)cstmt.getObject(1) ;
sun.jdbc.rowset.WebRowSet wrs = new sun.jdbc.rowset.WebRowSet() ;
wrs.populate(result) ;//in this statement,it will throw a NullPointerException
return wrs;
}
catch (Exception e)
{
CommLog.writeLog("pr", "PrLogic test: " + e.toString()) ;
return null ;
}finally
{
try
{
result.close() ;
}
catch (Exception e3)
{}


try
{
cstmt.close() ;
}
catch (Exception e1)
{}

try
{
conn.close() ;
}
catch (Exception e2)
{}

}

}
...全文
73 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
olvest4000 2001-09-06
  • 打赏
  • 举报
回复
没有啊,
关注!
祝你好运!!

62,612

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧