ORA-12518: TNS:listener could not hand off client connection
這種錯誤一般是在測試數據庫並發性的,多個用戶的,
後台用servlet方法執行個update ,只不過updated的記錄為1100個,後台一直報這個錯誤,
我也更改了oracle的連接數為1200,但是當執行到356行的時候,還是報上述的錯誤
解決方案:程序代碼的問題,執行更新後,沒有關閉連接,囧,切記關閉連接
public boolean update(Department e) {
boolean flag = true ;
String updateSQL = "update department set sort="+e.sort+" where id = " + e.getId();
try {
<span style="white-space:pre"> </span>stmt.executeUpdate(updateSQL);
} catch (Exception e1) {
e1.printStackTrace();
flag = false ;
}
return flag ;
}
public boolean update(Department e) {
boolean flag = true ;
String updateSQL = "update department set sort="+e.sort+" where id = " + e.getId();
try {
stmt.executeUpdate(updateSQL);
} catch (Exception e1) {
e1.printStackTrace();
flag = false ;
}finally{
stmt.close; //切記關閉
conn.close; //切記關閉
}
return flag ;
}
以前的程序代碼量小也沒發覺到不關閉的危害,這次終於嘗試到了,而且還花費了半天的時候找其他的原因,福禍相依,同時也發現了oracle的小秘密——並發性測試