0

I have an web app that use multithread process and each process open an connection with MYSQL like this this code:

Class.forName("com.mysql.jdbc.Driver").newInstance();
this.conn = DriverManager.getConnection("jdbc:mysql://" + SQL.host + "/" + SQL.database + "?user=" + SQL.username + "&password=" + SQL.password);

We set in mysql max-connection=10000.

Somes times we received this errors for each multithread process:

sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:423) com.mysql.jdbc.Util.handleNewInstance(Util.java:425) com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989) com.mysql.jdbc.MysqlIO.(MysqlIO.java:341) com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251) com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284) com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083) com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:806) com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47) sun.reflect.GeneratedConstructorAccessor147.newInstance(Unknown Source) sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) java.lang.reflect.Constructor.newInstance(Constructor.java:423) com.mysql.jdbc.Util.handleNewInstance(Util.java:425) com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410) com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328) java.sql.DriverManager.getConnection(DriverManager.java:664) java.sql.DriverManager.getConnection(DriverManager.java:270) MySQL.SQL.(SQL.java:37) SMS.ProccessSMSMessages.processMessage(ProccessSMSMessages.java:26) SMS.StaticData$1.OnWorker(StaticData.java:93) Utility.TimerWorker$1.run(TimerWorker.java:58) java.util.TimerThread.mainLoop(Timer.java:555) java.util.TimerThread.run(Timer.java:505) Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

toto
  • 1,180
  • 2
  • 13
  • 30
  • Unless you post more info: exception class, etc, I would think the server is down or a network failure. It states that the driver HAS NOT received packets from the server. – bichito Feb 26 '17 at 17:20
  • Andreas please the link that you offer as duplicate NOT have a solution. – toto Feb 26 '17 at 17:24
  • Hello, efektive, When the app start works fine with mysql. but when the app received around 50 concurrent open connection failded. – toto Feb 26 '17 at 18:09
  • That may be the case but the bottom of the exception is clear: driver is waiting for server. If all of the connections are experiencing the same then server is down or there is a network failure. – bichito Feb 26 '17 at 18:28

0 Answers0