- Mais recentes
- Mais votos
- Mais comentários
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:
- 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
-
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). -
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. -
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.
-
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.
Conteúdo relevante
- AWS OFICIALAtualizada há 2 anos