문서의 선택한 두 판 사이의 차이를 보여줍니다.
다음 판 | 이전 판 | ||
wiki:database:mariadb:troubleshooting [2020/06/29 08:40] jhgong 만듦 |
wiki:database:mariadb:troubleshooting [2023/01/13 18:44] (현재) |
||
---|---|---|---|
줄 2: | 줄 2: | ||
===== TimeZone error ===== | ===== TimeZone error ===== | ||
+ | |||
+ | JAVA에서 MySQL 혹은 MariaDB 서버에 연결시 다음과 같은 에러가 발생 할 수 있다. | ||
+ | |||
+ | < | ||
+ | ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: | ||
+ | |||
+ | Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: | ||
+ | |||
+ | Cannot create PoolableConnectionFactory (The server time zone value xxxxx 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.) | ||
+ | </ | ||
+ | |||
+ | 현재 데이터베이스의 타임존을 확인한다. | ||
+ | |||
+ | <code sql> | ||
+ | SELECT @@global.time_zone, | ||
+ | </ | ||
+ | |||
+ | 타임존이 SYSTEM으로 확인된다면 별도로 지정되어 있지 않다는 뜻이다. | ||
+ | |||
+ | |||
+ | * JDBC URL에 옵션추가 | ||
+ | <code java> | ||
+ | <bean id=" | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | *데이터베이스 서버에 default-time-zone 설정하기 | ||
+ | *my.ini 파일에 [mysqlId] 섹션에 default-time-zone을 추가한다. 아래는 KST로 지정한 것이다. | ||
+ | < | ||
+ | [mysqld] | ||
+ | default-time-zone=' | ||
+ | </ | ||
+ | default-time-zone=' | ||
+ | UTC로 지정하기 위해서는 ' | ||
+ | |||
+ | |||
+ | |||
+ | {{tag> | ||
+ | |||
+ |