The driver was unable to create a connection due to an inability to establish the client portion of a socket.
This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable.
For Unix-based platforms, see the manual page for the 'ulimit' command. Kernel or system reconfiguration may also be required.
数据库没问题,每次查询完执行:
if(rs!=null){
try {
rs.close();
} catch (Exception e) {
// TODO: handle exception
}
}
//关闭资源[先开后闭];
if(ps!=null){
try {
ps.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ps=null;//使用垃圾回收.
}
if(ct!=null){
try {
ct.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ct=null;
}
在一个方法里有个循环要反复去查询数据库,每次都是调用工具类去查询,也就是每次都执行了上面的关闭。可当查询到4000次左右时就抛出了上面的异常。请帮忙看看,万分感谢!