MySQL JDBC Connector Error - java

I'm using the latest MySQL version ... in my java application with named pipe and I started receiving the following error like 20 times in a row:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.
at ......
at ......
at ......
at ......
Caused by: java.io.FileNotFoundException: All pipe instances are busy
... 4 more
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.
at ......
at ......
at ......
at ......
Caused by: java.io.FileNotFoundException: All pipe instances are busy
... 4 more
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: 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.
at ......
at ......
at ......
at ......
Caused by: java.io.FileNotFoundException: All pipe instances are busy
... 4 more
The MySQL server is active and working properly through the command line and PHP. I'm using Windows 7 Ultimate. What is the cause of this java exception and how can I fix this?
Thank you.

Related

CommunicationsException: Communications link failure on docker-compose

I'm trying to run a docker-compose with MySQL and I'm getting the classic Communications link failure. I've already read some posts about it, but I still couldn't solve it.
| com.mysql.cj.jdbc.exceptions.CommunicationsException: 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.
Here is a link with code that I'm working on:
https://github.com/JonatasBaldasso/school-registration/tree/fix/docker-compose

IBM MQ 8 to 9 Migration

We have Sprintboot application on Azure Linux VM which is connecting to IBM MQ 8 and connection goes via KPN.
Recently we have upgraded IBM MQ from 8 to 9. No settings are changed on application, but with IBM MQ 9 - we can see that post 30 mins - connections are getting timed out and new connections are getting created post every 30 mins.
Checked with IBM MQ 9 team - no timeout setting at their end.
Error -
[com.ibm.mq.allclient-9.2.3.0.jar!/:9.2.3.0 - p923-L210708]
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2009;AMQ9208: Error on receive from host 'Host Details'. [1=javax.net.ssl.SSLException[Connection timed out (Read failed)],3=,4=TCP,5=InputStream.read]
Caused by: javax.net.ssl.SSLException: Connection timed out (Read failed)
Suppressed: java.net.SocketException: Broken pipe (Write failed)
enter code here`Caused by: java.net.SocketException: Connection timed out (Read failed)

Can't connect to the mysql installed in aws with local JDBC application [duplicate]

This question already has answers here:
Connect aws ec2 mysql with my local java application [duplicate]
(1 answer)
Solving a "communications link failure" with JDBC and MySQL [duplicate]
(25 answers)
Closed 1 year ago.
I have created a Ubuntu ec2 instance in AWS and installed the MySQL server. I've associated the instance with an elastic IP. I'm able to access the MySQL server with this address http://x.x.xxx.xx/phpmyadmin x.x.xxx.xx is my public elastic IP address. I can access the MySQL database with my MySQL workbench from my local machine. But I cant access it with my local java application.
This is my java connection code
conn = DriverManager.getConnection("jdbc:mysql://ec2-x-x-xxx-xx.ap-south-1.compute.amazonaws.com:3306/userDB",
"root", "password");
I'm getting the following error
Connecting to database...
com.mysql.cj.jdbc.exceptions.CommunicationsException: 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.
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:833)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:453)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)
at firstJDBCProgram.main(firstJDBCProgram.java:20)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: 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.
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at mysql.connector.java#8.0.23/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at mysql.connector.java#8.0.23/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
at mysql.connector.java#8.0.23/com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
at mysql.connector.java#8.0.23/com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
at mysql.connector.java#8.0.23/com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
at mysql.connector.java#8.0.23/com.mysql.cj.NativeSession.connect(NativeSession.java:144)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:953)
at mysql.connector.java#8.0.23/com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:823)
... 6 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.base/sun.nio.ch.Net.connect0(Native Method)
at java.base/sun.nio.ch.Net.connect(Net.java:574)
at java.base/sun.nio.ch.Net.connect(Net.java:563)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:333)
at java.base/java.net.Socket.connect(Socket.java:648)
at mysql.connector.java#8.0.23/com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
at mysql.connector.java#8.0.23/com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
... 9 more

Java Mysql Timeout Error

tried everything
connectTimeout=0&socketTimeout=0&autoReconnect=true
changed wait_timeout to 31536000 and interactive_timeout= 286399969
but still continue to get the error.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 70,399,485 milliseconds ago

Connection Time Out JDBC-MySQL

I have a Java application running Win 7 connecting to MySQL on the same host. Eclipse IDE shows the following error every time after 8-10mins.
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2214)
at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:781)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:348)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:284)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at iProclassHandlers.IProclass_Info_DAO.conn2SQL(IProclass_Info_DAO.java:151)
at iProclassHandlers.IProclass_Info_DAO.toString(IProclass_Info_DAO.java:140)
at iProclassParsers.IProclass_Info_Parser.printData(IProclass_Info_Parser.java:67)
at iProclassParsers.IProclass_Info_Parser.runParser(IProclass_Info_Parser.java:38)
at iProclassParsers.IProclass_main.main(IProclass_main.java:19)
Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure
This reported MySQL bug might explain it.
Try these:
Tomcat6 can't connect to MySql (The driver has not received any packets from the server)
https://serverfault.com/questions/89955/unable-to-connect-to-mysql-through-jdbc-connector-through-tomcat-or-externally
Can't make JDBC connection to MySQL (using Java, IntelliJ, and Linux)

Categories

Resources