Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
PD1615574355
Contributor
Contributor

MySQL Connection Refused when jobs run from bash shell - TOS works without issue.

We're currently running Talend 7.3.1 on Windows 2019 Server Datacenter Edition with MySQL 8 running on a separate Windows 2019 Server Datacenter Edition server. When running jobs from Talend Open Studio jobs process without issue. We've run Build Job and are now working to automate the process using bash scripts and are getting connection refused error (included below). I'm able to connect to and run queries using mysql from bash shell and am able to telnet to the ip:port. I've run out of ideas for how to determine root cause. Hoping someone can offer some suggestions.

E:\si\talend_jobs\Job Designs\stage_insurance_companies_data>java -Dtalend.component.manager.m2.repository="E:\si\talend_jobs\Job Designs\stage_insurance_companies_data/../lib" -Xms256M -Xmx8192M -cp .;../lib/routines.jar;../lib/lo

g4j-slf4j-impl-2.12.1.jar;../lib/log4j-api-2.12.1.jar;../lib/log4j-core-2.12.1.jar;../lib/accessors-smart-1.1.jar;../lib/mysql-connector-java-8.0.18.jar;../lib/json-path-2.1.0.jar;../lib/json-smart-2.2.1.jar;../lib/crypto-utils.jar;../li

b/filecopy.jar;../lib/slf4j-api-1.7.25.jar;../lib/dom4j-2.1.1.jar;stage_insurance_companies_data_0_1.jar;f_dim_insurance_companies_0_1.jar; maeva.stage_insurance_companies_data_0_1.stage_insurance_companies_data --context=Default

Exception in component tDBOutput_1 (stage_insurance_companies_data)

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 com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)

    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)

    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836)

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

    at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)

    at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)

    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)

    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)

    at maeva.stage_insurance_companies_data_0_1.stage_insurance_companies_data.tFileInputJSON_1Process(stage_insurance_companies_data.java:1629)

    at maeva.stage_insurance_companies_data_0_1.stage_insurance_companies_data.runJobInTOS(stage_insurance_companies_data.java:5003)

    at maeva.stage_insurance_companies_data_0_1.stage_insurance_companies_data.main(stage_insurance_companies_data.java:4844)

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 com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)

    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)

    at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)

    at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)

    at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91)

    at com.mysql.cj.NativeSession.connect(NativeSession.java:144)

    at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:956)

    at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:826)

    ... 8 more

Caused by: java.net.ConnectException: Connection refused: 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 com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)

    at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)

    ... 11 more

 

I should have included that environment was previously on single server and both TOS and bash worked fine. Issue has started since moving to the new servers.

Labels (2)
1 Solution

Accepted Solutions
PD1615574355
Contributor
Contributor
Author

Hi Sabrina,

 

Thanks for responding. I figured it out. There were actually 2 issues... After exporting/importing job designs into the new environment I changed the database user in dbconnections. Come to find out, the user wasn't being changed in the connections items file metadata. I deleted the build folder and built again. Items metatdata issue was then resolved but 'connection refused' error persisted. I then realized that the db user needed to be a Windows account on the database server. That is why TOS wasn't having an issue since it ran as an account that existed on both server but the jobs were using database user so had an issue using the .sh and .bat files. After creating a windows user for the database user the issue was resolved.

View solution in original post

3 Replies
Anonymous
Not applicable

Hello,

Is there any message in MySQL server logs?

There is a database connection error. It looks like the JDBC MySQL driver needs to know where to look for the client certificate.

Best regards

Sabrina 

PD1615574355
Contributor
Contributor
Author

Hi Sabrina,

 

Thanks for responding. I figured it out. There were actually 2 issues... After exporting/importing job designs into the new environment I changed the database user in dbconnections. Come to find out, the user wasn't being changed in the connections items file metadata. I deleted the build folder and built again. Items metatdata issue was then resolved but 'connection refused' error persisted. I then realized that the db user needed to be a Windows account on the database server. That is why TOS wasn't having an issue since it ran as an account that existed on both server but the jobs were using database user so had an issue using the .sh and .bat files. After creating a windows user for the database user the issue was resolved.

Anonymous
Not applicable

Hello,

Great this issue is fixed. And thanks for sharing your solution with us on community.

Best regards

Sabrina