something about WebRowSet
我想由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)
{}
}
}