请先看我的代码:
public Vector select(Object pojo,String condition , String conditionValue){
Vector v = new Vector();
GetConnection getConn = null ;
SQLFactory sf = new SQLFactory(pojo);
String sql = sf.createSql(
SQLFactory.SELECT,condition,conditionValue);
try{
getConn = new GetConnection();
conn = getConn.getConnection() ;
stat = conn.createStatement();
rs = stat.executeQuery(sql);
while(rs.next()){
Vector tempV = new Vector();
tempV.add(rs.getInt(1));
tempV.add(rs.getString(2));
tempV.add(rs.getString(3));
tempV.add(rs.getString(4));
v.add(tempV);
}
}
catch(Exception err){
err.printStackTrace();
}
finally{
try {
System.out.println(rs);
if( null != rs
&& !rs.isClosed() )
rs.close();
rs = null ;
if( null != stat && !stat.isClosed())
stat.close();
stat = null ;
} catch (SQLException e) {
e.printStackTrace();
}
getConn.close();
conn = null ;
}
return v ;
}
这个代码,报错如下:
oracle.jdbc.driver.OracleResultSetImpl@1dfc547
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.OracleResultSetImpl.isClosed()Z
at dao.BasicDBOImpl.select(BasicDBOImpl.java:124)
at util.CheckData.isExist(CheckData.java:12)
at dao.BasicDBOImpl.add(BasicDBOImpl.java:26)
at dao.BasicDBOImpl.main(BasicDBOImpl.java:140)
从报错情况看,输出:oracle.jdbc.driver.OracleResultSetImpl@1dfc547,
说明rs不为null,
与此同时,at dao.BasicDBOImpl.select(BasicDBOImpl.java:124),
说明问题出在第125&& !rs.isClosed()这里!
-------------------------
问题1,既然rs没问题,怎么会有错 ?
问题2:怎么改 ?
菜鸟求教
------解决方案--------------------