多线程使用DriverManagerDataSource报创建连接失败问题

在本地运行的时候,多线程操作数据会产生这样一个错误。查找了一些资料后发现: 
DriverManagerDataSource建立连接是只要有连接就新建一个connection,根本没有连接池的作用。改为以下开源的连接池会好点(org.apache.commons.dbcp.BasicDataSource)。
 


Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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. 

For Windows-based platforms, see Microsoft Knowledge Base Article 196271 (Q196271). 


  
  
          
          
          
          
  

你可能感兴趣的:(iteye)