Home > Database > Mysql Tutorial > servlet执行update报错ORA-12518

servlet执行update报错ORA-12518

WBOY
Release: 2016-06-07 16:45:26
Original
1266 people have browsed it

ORA-12518: TNS:listener could not hand off client connection这种错误一般是在测试数据库并发性的,多个用户的,后台用servle

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 {
  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)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

本文永久更新链接地址:

linux

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template