Servlet update execution error ORA-12518
ORA-12518: TNS: listener cocould not hand off client connection
This error is generally tested for database concurrency by multiple users,
The backend executes an update using the servlet method, but the updated record is 1100. This error is always reported in the backend,
I also changed the number of connections in Oracle to 1200. However, when the number of connections reaches 356, the above error is still reported.
Solution: the connection is not closed after updating the program code. Please remember to close the connection.
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.exe cuteUpdate (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.exe cuteUpdate (updateSQL );
} Catch (Exception e1 ){
E1.printStackTrace ();
Flag = false;
} Finally {
Stmt. close; // remember to close
Conn. close; // remember to close
}
Return flag;
}
The previous program code was too small to detect the danger of not shutting down. This time, I finally tried it and spent half a day looking for other reasons, at the same time, we also discovered the little secret of oracle-concurrency Testing
Install Oracle 11gR2 (x64) in CentOS 6.4)
Steps for installing Oracle 11gR2 in vmwarevm
Install Oracle 11g XE R2 In Debian