| 发表于:2007-09-17 18:05:22 楼主 |
大家好: db2 v9的resultset 好像是 next完最后一条就自动关闭了,不知道是不是我的连接串有问题,同样的测试程序在db2 v8上就没有问题,特请教,谢谢! public void testdb2v9(){ try{ statement stm = _con.createstatement(); resultset rs = null; string sql = " select * from test_a "; rs = stm.EXECutequery(sql); while(rs.next()){ system.out.println("---" + rs.getint("id")); } if (rs != null && (!rs.next)){ rs.close(); } stm.close(); }catch(exception ex){ ex.printstacktrace(); } } 这里到了 if (rs != null && (!rs.next)){ 这一句报 com.ibm.db2.jcc.c.sqlexception: [ibm][db2][jcc][10120][10898] 操作无效:已关闭 result set。 另外,如何能知道,这个rs已经关闭,谢谢大家 |
|
|
|
|