Connection con = DriverManager.getConnection("-------"); Statement stmt = con.createStatement("----"); ResultSet rs = stmt.executeQuerty("Select * from Emp");
After executing this statement if the oracle database server crashes,I still want to maintain my resultset.Would the object "rs" still pursive or not?
posted 12 years ago
Nope, that resultset is dependent on the connection object being valid. If the server crashes, the connection object is hosed. The next time you try to use it, you will probably receive an SQLException that's wrapped around an IOException.
For that and other reasons, it is often a good idea to immediately read your ResultSet and store it into a disconnected data structure. For example, a simple way to do that is to iterate through the ResultSet and store each record into an Onject array and put each array into an ArrayList. Once you have your ArrayList built, you no longer need the ResultSet and you can close it.
Of course, if the db server crashes while you are still iterating the ResultSet, your out of luck.
Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Yes, my master! Here is the tiny ad you asked for:
the new thread boost feature: great for the advertiser and smooth for the coderanch user