Using aws-secretsmanager-jdbc with HikariCP triggers sporadic
communication link failures with MySQL.
aws-secretsmanager-jdbc library provides JDBC drivers to retrieve
DB credentials, host and password from the Amazon Secrets Manager.
See:
- https://docs.aws.amazon.com/secretsmanager/latest/userguide/retrieving-secrets_jdbc.html
- https://github.com/aws/aws-secretsmanager-jdbc
By specifying the secret id as a JDBC an URL, and
com.amazonaws.secretsmanager.sql.AWSSecretsManagerMySQLDriver as
JDBC driver, HikariCP can connect to the MySQL endpoint.
But in this stituation, communication link failures occur:
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet successfully received from the server was 5,006 milliseconds ago.
The last packet sent successfully to the server was 5,007 milliseconds ago.
These failures are due a MySQL bug: http://bugs.mysql.com/bug.php?id=75615 which is
bypassed by HikariCP when the MySQL driver is used. See:
- brettwooldridge#236
- 8af2bc5 (Fix brettwooldridge#236 via workaround for MySQL issue http://bugs.mysql.com/bug.php?id=75615, 2015-01-24)
This commit applies the same hack for AWSSecretsManagerMySQLDriver.
See commit message.