com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

Highlighted
Five Stars

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

I am working on a study project and I have been stuck for 2 days in this error.

 

[statistics] connecting to socket on port 3608
[statistics] connected
Exception in component tDBInput_1 (Dim_Segment)
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 233 317 milliseconds ago. The last packet sent successfully to the server was 233 317 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)
at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2288)
at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:2044)
at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3549)
at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:489)
at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3240)
at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2411)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2834)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2832)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2781)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1569)
at alidade_dw.dim_segment_0_1.Dim_Segment.tDBInput_1Process(Dim_Segment.java:3064)
at alidade_dw.dim_segment_0_1.Dim_Segment.runJobInTOS(Dim_Segment.java:4332)
at alidade_dw.dim_segment_0_1.Dim_Segment.main(Dim_Segment.java:4181)
Caused by: java.io.EOFException: Can not read response from server. Expected to read 12 bytes, read 0 bytes before connection was unexpectedly lost.
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3161)
at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2269)
... 12 more
[statistics] disconnected

 


Accepted Solutions
Five Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

Think you vapukov for your response .

Finally I was able to fix the problem by enabling stream in advanced parameter in the tMySQLInput.


All Replies
Five Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

I think that this member had the same issues, but I did not understand how he fix it.

https://talendforge.org/forum/viewtopic.php?pid=124656

 

Forteen Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

Hi,

 

is it remote mysql server or local?

if remote is it on linux or on windows server?

 

in any case - first what you need to do with any connection error, it is trying to connect to the same resource (server) with the standard client from the Talend machine

 

for MySQL it could be MySQL Workbench.

can you connect to same server, with same settings from your Talend machine with MySQL command line client or MySQL Workbench?

 

there are 2 main possible reasons for error:

  • firewall rules
  • MySQL server settings - many of them do not listen to connections from network

If the reason is firewall rules - you will need enable MySQL connections from you Talend machine ip address

If it server settings, you need or change them or create ssh tunnel before tMySQLInput 

 

-----------
Five Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

Hi,

Thank you for the quick response.

It is a local server.

when i tryed to check the connection in  Metadata repository it tell me that the connection is established

do I have to remove Mysql and reinstall it in my machine ?

 

how can i connect to same server, with same settings from my Talend machine with MySQL command line client or MySQL Workbench?

how can i enable MySQL connections from you Talend machine ip address ?

and what is the role of ssh tunnel before tMySQLInput ?

Forteen Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

Hi

 

if mysql is local (means on the same machine with Talend) - need more information

 

what mysql? what settings you use in repository (where you successfully connect) and what in tMySQLInput, and etc

 

regards

-----------
Five Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

Think you vapukov for your response .

Finally I was able to fix the problem by enabling stream in advanced parameter in the tMySQLInput.

Two Stars

Re: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure with mysql

I have had this error for two days:

 

Exception in component tMysqlConnection_3 (Main)

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 sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)

at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1127)

at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:674)

at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1086)

at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2506)

at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2539)

at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2321)

at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:832)

at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)

at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:417)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)

at java.sql.DriverManager.getConnection(DriverManager.java:664)

at java.sql.DriverManager.getConnection(DriverManager.java:247)

at core_etl.main_0_7.Main.tMysqlConnection_3Process(Main.java:3022)

at core_etl.main_0_7.Main.tFileList_1Process(Main.java:2829)

at core_etl.main_0_7.Main.tJava_7Process(Main.java:1684)

at core_etl.main_0_7.Main.runJobInTOS(Main.java:10350)

at core_etl.main_0_7.Main.main(Main.java:9596)

Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:3161)

at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:598)

 

I am able to connect to my database through SequelPro.  This error has been a new one, only in the last two days.  Before, the job ran through successfully.  Any ideas?

 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog