3
我正在運行代碼,但是得到「無效狀態,ResultSet對象已關閉」。錯誤。什麼導致了錯誤?無效狀態,結果集對象關閉
try{
query = "SELECT * FROM BUNDLE_TEMP "
+ "MINUS "
+ "SELECT * FROM BUNDLE";
rs = stmt.executeQuery(query);
while (rs.next()){
String bundle = rs.getString("BUNDLE");
String week = rs.getString("WEEK");
String sched_dt = rs.getString("SCHED_DT").replace(" 00:00:00.0", "");
String dropper_id = rs.getString("DROPPER_ID");
query = "INSERT INTO BUNDLE "
+ "VALUES ('"
+ bundle+"','"
+ week+"','"
+ sched_dt+"','"
+ dropper_id+"')";
stmt.executeUpdate(query);
}
}catch(Exception e){
System.out.println("Error while trying to insert into BUNDLE\n"+query+"\n"+ e);
}
請在您的問題中發佈異常堆棧跟蹤,它包含有價值的信息來診斷您的問題。 –
Philipp是對的。我認爲你甚至可能發生網絡中斷,從而導致兩個查詢之間的連接中斷,並且問題可能會導致您向我們顯示的相同信息。 – Kheldar