while testing connection from glue to mysql rds database i am getting below error

0

Loading class com.mysql.jdbc.Driver'. This is deprecated. The new driver class is com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.

sumit
asked a month ago194 views
1 Answer
1

com.mysql.jdbc.Driver is deprecated, and the newer driver class com.mysql.cj.jdbc.Driver should be used instead. This change came about with newer versions of the MySQL JDBC connector (starting from version 8.0), aiming to improve performance and provide additional features.

To resolve this issue, update your JDBC connection settings in AWS Glue to use the new driver class. Here's how you can address this:

  1. Update JDBC URL and Driver Class Ensure that your JDBC connection string and driver class are updated in your Glue job's configuration:

Driver Class: Use com.mysql.cj.jdbc.Driver instead of com.mysql.jdbc.Driver.

JDBC URL: Make sure your JDBC URL is compatible with the newer driver. The URL typically looks like this for the newer driver:

jdbc:mysql://your-database-endpoint:3306/your-database-name?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
  1. Include the MySQL Connector Jar AWS Glue should automatically have access to the MySQL connector. However, if you're managing custom libraries (jars), ensure you're using a MySQL connector version that supports the com.mysql.cj.jdbc.Driver class (MySQL Connector/J 8.0 or later).

  2. Adjust Additional Parameters (if necessary) The newer MySQL JDBC driver (com.mysql.cj.jdbc.Driver) may require additional parameters in the JDBC URL or alterations to default settings to ensure compatibility with your application's requirements. Common parameters include timezone settings (serverTimezone=UTC), character encoding, and SSL configuration. Review the MySQL Connector/J documentation for a comprehensive list of parameters.

  3. Test Your Connection After making these changes, test your connection from AWS Glue to your MySQL RDS database again to ensure the error is resolved and the connection is successful.

  4. Update Your Code (if applicable) If your Glue job includes custom scripts or libraries referencing the deprecated driver class, update these references to the new class com.mysql.cj.jdbc.Driver.

Note: The error message also mentions that manual loading of the driver class is generally unnecessary. This is because the JDBC 4.0 and later versions automatically detect and load JDBC drivers, so you typically don't need to load the JDBC driver class in your code manually. However, ensuring your connection string and any code references are updated is essential for compatibility and to avoid deprecated warnings.

profile picture
EXPERT
answered a month ago
profile picture
EXPERT
Artem
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions