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

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

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

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