티스토리 뷰

공부

[Spring] MySQL 연동 KST 에러

승가비 2018. 10. 9. 17:34
728x90

[Spring] MySQL 연동 KST 에러


토비의스프링 책을 사서 하나씩 따라 해보는 중이다.

IntelliJ를 사용하니까 편리하게 SpringBoot 환경을 구축할 수 있었다.


토비의 스프링에는 따로 MySQL을 연동하는 방법이 나와 있지 않아서 

하나씩 구글링하면서 부족한 부분을 매꾸고 있다.


그중에 하나가 MySQL의 5.1.X 버전부터 KST 타임존을 인식 못하는 에러다.

`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 specifc time zone value if you want to utilize time zone support`


Class.forName("com.mysql.jdbc.Driver");
Connection c = DriverManager.getConnection(
"jdbc:mysql://localhost/springbook?characterEncoding=UTF-8&serverTimezone=UTC", "root", "****");

뒤쪽에 ?characterEncoding=UTF-8&serverTimezone=UTC 을 추가해서 해결했다.



[출처] https://yenaworldblog.wordpress.com/2018/01/24/java-mysql-%EC%97%B0%EB%8F%99%EC%8B%9C-%EB%B0%9C%EC%83%9D%ED%95%98%EB%8A%94-%EC%97%90%EB%9F%AC-%EB%AA%A8%EC%9D%8C/

728x90

'공부' 카테고리의 다른 글

[Java] JDBC execute vs executeQuery vs executeUpdate 차이  (0) 2018.10.24
[Java] String split multi delimiter  (0) 2018.10.19
[Linux] shell alias  (0) 2018.10.08
[DS] Heap?  (0) 2018.10.04
[JS] NodeJS Server의 특징과 단일 스레드인 이유  (0) 2018.10.04
댓글