两个类 当个类运行正常 连起来方法调用 就报异常 一个类中 有个sleep(6000) 就是线程方法
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).
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at
com.mysql.jdbc.SQLError.create
CommunicationsException(SQLError.java:1118)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:343)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2308)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2122)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:774)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:49)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:375)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:289)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.dao.ConnectionManager.getConnection(ConnectionManager.java:28)
at com.domain.BlackList.queryPhone(BlackList.java:32)
at com.domain.Main.main(Main.java:8)
Caused by:
java.net.BindException: Address already in use: connect两个类 当个类运行正常 连起来方法调用 就报异常 一个类中 有个sleep(6000) 就是线程方法 晕闹心草是 连接关了
------解决方案--------------------he driver was unable to create a connection due to an inability to establish the client portion of a socket.
这句话的意思就是你在创建一个数据库连接的时候。使用这个connection这在操作数据的时候。不能过再重新创建另外一个connection来做做其他数据。
例如
while(rs.next()){
//正在读取数据
//创建一个conn修改数据
有异常
}
------解决方案--------------------
自己查找吧 都是很不耐 都不咋会 会的人少之又少 虚心使人进步