我收到錯誤java.sql.SQLException:Exhausted ResultSet以對Oracle數據庫運行查詢。通過Websphere中定義的連接池進行連接。執行的代碼如下: if (rs! = null) ( while (rs.next ()) ( count = rs.getInt (1); ) )我注意到結果集包含數據(rs.next())謝謝
3 回答

慕神8447489
TA貢獻1780條經驗 獲得超1個贊
在處理結果集后嘗試訪問列值時,我已經看到此錯誤。
if (rs != null) {
while (rs.next()) {
count = rs.getInt(1);
}
count = rs.getInt(1); //this will throw Exhausted resultset
}
希望能幫到你 :)

收到一只叮咚
TA貢獻1821條經驗 獲得超5個贊
嘗試這個:
if (rs != null && rs.first()) {
do {
count = rs.getInt(1);
} while (rs.next());
}

猛跑小豬
TA貢獻1858條經驗 獲得超8個贊
當數據庫沒有針對特定條件返回的記錄時,以及當我嘗試訪問rs.getString(1)時;我收到此錯誤“筋疲力盡的結果集”。
在發行之前,我的代碼是:
rs.next();
sNr= rs.getString(1);
修復后:
while (rs.next()) {
sNr = rs.getString(1);
}
添加回答
舉報
0/150
提交
取消