2013年9月6日星期五

Database is shut down abnormal

Please look at my code :

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 ;
}

this code , given as follows:
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)

From the error situation, output : oracle.jdbc.driver.OracleResultSetImpl @ 1dfc547,
Description rs is not null,
Meanwhile , at dao.BasicDBOImpl.select (BasicDBOImpl.java: 124),
explain the problem in the first 125 &&! rs.isClosed () here !

-------------------------

Question 1 , since rs no problem , how to be wrong ?

Question 2: how to change ?


rookie neighborhoods
------ Solution ---------------------------------- ----------
change in the other versions of the drivers try
------ Solution -------------------- ------------------------
estimate is oracle.jdbc.driver.OracleResultSetImpl not given isClosed () implementation , resulting in an abstract call method error
------ Solution -------------------------------------- ------
interested then you can go look at the source
------ Solution ---------------------------------- ----------
if not open source , or find the official documentation to see it, what the specific reason is not good Luancai
------ Solution ----------------- ---------------------------
I have also experienced similar problems, I was solved .

In the above defined in advance : ResultSet rs = null;
------ Solution -------------------- ------------------------
compile without error ? As mentioned upstairs , rs did not define the try out ah.
------ Solution ---------------------------------------- ----
judge rs.isclosed Why do you want it ? Used directly after rs.close on the line. Concrete can see jar package source BasicDBOImpl interface
------ Solution ------------------------------- -------------
seemingly no problem , ah, the jar replacement of
------ For reference only ------------ ---------------------------
I think this was supposed to Zhang unsinkable posted ... SOS ; ... help ...
------ For reference only -------------------------- -------------


are the same, this is where the problem lies in line 27 and line 28 :

                if( null != rs 
                        && !rs.isClosed() )

If ! rs.isCloed () to remove the program to normal. Very tangled !
[ the "&& " to "| |" is not acceptable ]
------ For reference only -------- -------------------------------


abstract method to see how source code, do not know where to achieve !
I really white , and
Great God take a road, pointing ...
------ For reference only -------------------- -------------------


Well !
------ For reference only -------------------------------------- -


My ResultSet is a class variable , not a function of local variables !
My Connection \ Statement \ ResultSet is a class variable ,
follows:
conn = null; stat = null; rs = null;
Then, re- create the appropriate space inside the function , run out of the release !
------ For reference only -------------------------------------- -


inside my program is a database connection is a class variable at this level ! Defined explicitly defined as null
Then, inside the function to create the appropriate connection !
Similarly, in a function created and released in a function !
------ For reference only -------------------------------------- -


little relationship with the jar !
using jdbc oracle 10g which comes class12.jar!
------ For reference only -------------------------------------- -


problem is found, the Oracle native driver problem ! ! !

没有评论:

发表评论