awslabs / aws-mysql-jdbc

The Amazon Web Services (AWS) JDBC Driver for MySQL is a driver that enables applications to take full advantage of the features of clustered MySQL databases.
https://awslabs.github.io/aws-mysql-jdbc/
Other
228 stars 49 forks source link

Error Initializing DB Connection to Aurora DB in `AWS-CN` without `enableClusterAwareFailover=false` #503

Closed hippozhengsc closed 5 months ago

hippozhengsc commented 1 year ago

Describe the bug

Create an Aurora DB in AWS-CN Region like cn-north-1. and notice the url of the DB Cluster endpoint is something like the following: db-identifier.cluster-XYZ.cn-north-1.rds.amazonaws.com.cn:3306

And this URL should be regarded as an acceptable AWS RDS cluster URL and the failover should be enabled by default.

Expected Behavior

enableClusterAwareFailover=false is not required for aurora DB created in aws-cn

Current Behavior

The following error is thrown out without the parameter:

Caused by: java.sql.SQLException: The clusterInstanceHostPattern configuration property is required when an IP address or custom domain is used to connect to a cluster that provides topology information. If you would instead like to connect without failover functionality, set the enableClusterAwareFailover configuration property to false. 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.plugins.failover.FailoverConnectionPlugin.initExpectingNoTopology(FailoverConnectionPlugin.java:972) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.plugins.failover.FailoverConnectionPlugin.initProxy(FailoverConnectionPlugin.java:1019) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.plugins.failover.FailoverConnectionPlugin.openInitialConnection(FailoverConnectionPlugin.java:248) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.plugins.ConnectionPluginManager.openInitialConnection(ConnectionPluginManager.java:151) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.ConnectionProxy.initPluginManager(ConnectionProxy.java:293) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.ConnectionProxy.(ConnectionProxy.java:107) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.ConnectionProxy.(ConnectionProxy.java:93) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.ConnectionProxy.(ConnectionProxy.java:81) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.ha.ConnectionProxy.autodetectClusterAndCreateProxyInstance(ConnectionProxy.java:129) 12:16:01 [sshexec] at software.aws.rds.jdbc.mysql.shading.com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:221) 12:16:01 [sshexec] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677) 12:16:01 [sshexec] at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228)

Reproduction Steps

jdbc:mysql:aws://db-identifier.cluster-XYZ.cn-north-1.rds.amazonaws.com.cn:3306

Possible Solution

No response

Additional Information/Context

N/A

The AWS JDBC Driver for MySQL version used

com.amazonaws:aws-java-sdk-secretsmanager:1.11.681

JDK version used

openjdk version "11.0.19" 2023-04-18 OpenJDK Runtime Environment Temurin-11.0.19+7 (build 11.0.19+7) OpenJDK 64-Bit Server VM Temurin-11.0.19+7 (build 11.0.19+7, mixed mode)

Operating System and version

MacOS, Linux

crystall-bitquill commented 10 months ago

Hi @hippozhengsc,

Thanks for reaching out and raising this issue. We've recently merged in a PR (#543) to address this. Could you kindly check out our latest snapshot build and let us know if the issue persists?

And to let you know, while the AWS JDBC Driver for MySQL is still being maintained at the moment, new features will no longer be added to the driver and all future developments will take place in the AWS JDBC Driver project. More details can be found on the maintenance policy. We encourage users of the AWS JDBC Driver for MySQL to try out the AWS JDBC Driver, as it provides similar and additional features. There is a migration guide available here.

Thank you!

philipogormanjca commented 9 months ago

I got this error connecting using JetBrains datagrip, i switched the driver to "MariaDB driver for Auorora MySQL" and the error went away

crystall-bitquill commented 9 months ago

Hi all,

The fix for this issue has been included in the latest release of the AWS JDBC Driver for MySQL, version 1.1.14, which is now available.

And for your comment @philipogormanjca,

I got this error connecting using JetBrains datagrip, i switched the driver to "MariaDB driver for Auorora MySQL" and the error went away

What version of the driver were you using? Would you be able to try out the latest version and let us know if the issue persists?

Thank you!

philipogormanjca commented 9 months ago

I tried 1.1.9 and i got the errror

crystall-bitquill commented 8 months ago

Hi @philipogormanjca,

It looks like JetBrains DataGrip does not have the latest version of the driver. Are you able to download the driver JAR from our latest release and use it in DataGrip? The aws-mysql-jdbc-1.1.14.jar file is available here and it looks like users should be able to specify custom JAR files in DataGrip, as seen here.

marcosfreitas commented 6 months ago

For reference, using Datagrip, with driver version 1.1.14 I got this error below, it only works if I change to Mysql or Maria DB offered drivers.

image

image

aaronchung-bitquill commented 6 months ago

Hi @marcosfreitas

Just to double check, are you also connecting to an Aurora DB cluster in AWS-CN?

Additionally, are there any other settings/properties that you may be using that you are able to share?

Thank you!

marcosfreitas commented 6 months ago

Hi @aaronchung-bitquill , no additional settings. It was a fresh installed Data Grip. I also tried to connect using the cluster address but got the same error.

aaronchung-bitquill commented 6 months ago

@marcosfreitas can you share what your the endpoints you are using look like, and with the secret information redacted?

davecramer commented 5 months ago

Support for this driver will be ending July 25/2024 as per the https://github.com/awslabs/aws-mysql-jdbc/blob/main/CONTRIBUTING.md document. Any new features will be implemented in https://github.com/aws/aws-advanced-jdbc-wrapper

incraigulous commented 5 months ago

@hippozhengsc try using the MariaDB driver for Aurora MySQL. That worked for me.

Screenshot 2024-06-25 101404