Connection Failed, Communication link failure error

Hello Team,

I am getting “Connection Failed, Communication link failure error” when I try to use Test Connection button under Project Settings > Database on my Mac machine, The same button works fine on Windows machine, This is causing test cases to error out on Mac but they work fine on Windows.

I am using exact same code and everything and also confirmed with our dev team that the database is not facing any issues on there side.

Screen Shot 2020-07-23 at 12.04.12 PM

Elapsed time: 2m - 17.875s

com.katalon.plugin.keyword.connection.DatabaseKeywords.invokeMethod:0

Test Cases/International/Create order with Relaxed Fit 15 pack Quantity 1 FAILED.
Reason:
org.codehaus.groovy.runtime.InvokerInvocationException: 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.katalon.plugin.keyword.connection.DatabaseKeywords.invokeMethod(DatabaseKeywords.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at Create order with Relaxed Fit 15 pack Quantity 1.run(Create order with Relaxed Fit 15 pack Quantity 1:183)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:339)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:330)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:309)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:301)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:235)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1595530681341.run(TempTestCase1595530681341.groovy:25)
Caused by: 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:835)
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
	at com.kms.katalon.core.db.DatabaseConnection.getConnection(DatabaseConnection.java:141)
	at com.kms.katalon.core.db.DatabaseConnection.getConnection(DatabaseConnection.java:112)
	at com.kms.katalon.core.db.DatabaseConnection$getConnection.call(Unknown Source)
	at com.katalon.plugin.keyword.connection.DatabaseKeywords.getGlobalConnection(DatabaseKeywords.groovy:27)
	at com.katalon.plugin.keyword.connection.DatabaseKeywords.invokeMethod(DatabaseKeywords.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at Script1595456231126.run(Script1595456231126.groovy:183)
	... 11 more
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 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:152)
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:955)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
	... 21 more
Caused by: java.net.ConnectException: Operation timed out (Connection timed out)
	at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155)
	at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65)
	at com.mysql.cj.NativeSession.connect(NativeSession.java:152)
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:955)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825)
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
	at com.kms.katalon.core.db.DatabaseConnection.getConnection(DatabaseConnection.java:141)
	at com.kms.katalon.core.db.DatabaseConnection.getConnection(DatabaseConnection.java:112)
	at com.kms.katalon.core.db.DatabaseConnection$getConnection.call(Unknown Source)
	at com.katalon.plugin.keyword.connection.DatabaseKeywords.getGlobalConnection(DatabaseKeywords.groovy:27)
	at com.katalon.plugin.keyword.connection.DatabaseKeywords.invokeMethod(DatabaseKeywords.groovy)
	at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:50)
	at Create order with Relaxed Fit 15 pack Quantity 1.run(Create order with Relaxed Fit 15 pack Quantity 1:183)
	... 11 more

Manpreet, post you KS version…

@duyluong @ThanhTo any issue using db over Mac?

@manpreet.mukkar

It might be your network issue. You should change the connection URL from host name to the database IP address.
Related issues: https://stackoverflow.com/questions/2983248/com-mysql-jdbc-exceptions-jdbc4-communicationsexception-communications-link-fai
https://stackoverflow.com/questions/14559794/mysql-with-java-error-the-last-packet-sent-successfully-to-the-server-was-0-mil

@duyluong Sorry for late reply, It was an issue on our end, Some configuration was changed without informing the team that resulted in the issue

1 Like