JDBC查询大量数据异常问题
    当连续对数据库进行查询操作时,出现如下异常:
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; 
} 
我改成每次查询完不关闭connection,但是又报java虚拟机内存不足的异常。
解决办法:
在数据库工具类中设置一个int变量,每次执行数据操作时 ++,当大于1000时执行关闭操作。问题解决。
不知道还有没有更好的方法。