[問題] PreparedStatement 與 Cursor 的關係
Method 如下:
public void insert(Connection i_conn) throws Exception {
PreparedStatement ps = null;
String strSql = " insert into table1 ( id ) values ( ? ) ";
try {
ps = i_conn.prepareStatement(strSql);
ps.setString(1, getId());
ps.executeUpdate();
} finally {
try {
ps.close();
} catch (Exception e) {
}
}
}
從外部傳入 Connection 重複執行 insert 8000 次 做完後在外部一起Commit
偶爾會出現 Maximum open cursors exceeded (ORA-01000) 的錯誤
DB 是 Oracle 10g 預設 Cursor 是 300個
請問是因為 一個 prepareStatement 產生一個 Cursor 嗎?
可是程式有進行close 是因為產生的來不及關閉嗎?
還是我的觀念錯誤!?
謝謝~~~
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.24.70.77
※ 編輯: joetsai 來自: 114.24.70.77 (07/07 22:25)
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):