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
질문됨 2달 전219회 조회
1개 답변
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
전문가
답변함 2달 전
profile picture
전문가
Artem
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠