Loading

Cannot get connection for URL of MySQL DB: Communications link failure

게시 일자: Mar 2, 2024
솔루션

SYMPTOM

The Database Config element for MySQL is as below:
<db:config name="Database_Config" doc:name="Database Config" doc:id="249c41bc-c65d-4c6a-a858-94e7ed63ae97" >
	<db:my-sql-connection host="samplemysql.com" port="3306" user="myuser" password="mypassword" database="TESTDB" >
		<db:connection-properties >
			<db:connection-property key="useSSL" value="true" />
			<db:connection-property key="requireSSL" value="true" />
			<db:connection-property key="verifyServerCertificate" value="false" />
		</db:connection-properties>
	</db:my-sql-connection>
</db:config>
The following exception is thrown during application deployment:
[2021-12-15 14:44:09.598] INFO  LifecycleAwareConfigurationInstance [[MuleRuntime].uber.02: [test-rds].uber@org.mule.runtime.module.extension.internal.runtime.config.LifecycleAwareConfigurationInstance.testConnectivity:179 @5f1ee9a5] [event: ]: Connectivity test failed for config 'Database_Config'. Application deployment will continue. Error was: Could not obtain connection from data source
org.mule.runtime.api.connection.ConnectionException: Could not obtain connection from data source
Caused by: org.mule.extension.db.api.exception.connection.ConnectionCreationException: Could not obtain connection from data source
Caused by: org.mule.runtime.extension.api.exception.ModuleException: java.sql.SQLException: Cannot get connection for URL jdbc:mysql://samplemysql.com:3306/TESTDB?verifyServerCertificate=false&useSSL=true&requireSSL=true : Communications link failure

The last packet successfully received from the server was 121 milliseconds ago.  The last packet sent successfully to the server was 115 milliseconds ago.

CAUSE

The root cause is TLS handshake failure. This happens after a JDK update where the support for TLSv1 and TLSv1.1 is dropped.

SOLUTION

Add the following database connection property to the Database Config element:
<db:connection-property key="enabledTLSProtocols" value="TLSv1.2" />
Knowledge 기사 번호

001119314

 
로드 중
Salesforce Help | Article