gbmin's Tech Notes

서버 구축 및 유지보수, 클라우드 컴퓨팅, 네트워크 보안, IT 분야 기술 노트. :)

Tech Notes/Trouble Shooting

Spring Boot - Loading class com.mysql.jdbc.Driver'. This is deprecated.

gbmin 2023. 6. 23. 15:01

Spring Boot - 디버깅 사례

1. 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.

 

MySQL JDBC 드라이버가 더 이상 사용되지 않는다는 것을 알려주는 경고다.'com.mysql.cj.jdbc.Driver'를 사용해야 한다.

해결하려면 코드에서 JDBC 드라이버를 로딩하는 부분을 찾아 'com.mysql.cj.jdbc.Driver'로 변경하면 된다.

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
>> spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver



2. The server time zone value 'KST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the 'serverTimezone' configuration property) to use a more specific time zone value if you want to utilize time zone support.


서버의 시간대 설정이 JDBC 드라이버에 의해 인식되지 못하는 'KST'로 설정되어 있어서 발생되는 에러다. 해결하려면 'serverTimezone' 속성을 사용하여 시간대를 지정해야 한다.

String url = "jdbc:mysql://localhost/db?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Seoul";