首页 / 数据库 / MySQL / servlet执行update报错ORA-12518
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的小秘密——并发性测试在CentOS 6.4下安装Oracle 11gR2(x64) http://www.linuxidc.com/Linux/2014-02/97374.htmOracle 11gR2 在VMWare虚拟机中安装步骤 http://www.linuxidc.com/Linux/2013-09/89579p2.htmDebian 下 安装 Oracle 11g XE R2 http://www.linuxidc.com/Linux/2014-03/98881.htm更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12本文永久更新链接地址