원인
- WAS가 DB와 연결하고자 하는 Timezone 'KST'를 인식할 수 없어서 발생
조치
- JDBC URL에 serverTimezone 추가
조치 예시
- jdbc:mysql://127.0.0.1:3306/mydb_name?serverTimezone=Asia/Seoul
serverTimezone 을 Asia/Seoul로 하는 이유는 Error에서 'KST' timezone으로 연결하려고 했는데 실패했기 때문에 넣었지만 정확하게 설정하고 싶으면 아래 내용을 참고
- Mysql timezone 확인하기
- SELECT @@time_zone, now();
- Time_zone 이 SYSYTEM인 경우 system_time_zone 확인
- SHOW VARIABLES WHERE Variable_name LIKE '%time_zone%';
- system_time_zone이 KST일때 JDBC URL옵션에 ServerTimezone을 UTC로 연결할 경우, 쿼리 SELECT문의 시간 정보 리턴 값
- Select now() 결과 값 (한국시간 2023-04-03 09:55:46에 조회)
JDBC로 조회 | DB에서 직접 조회 |
2023-04-03 18:55:46 | 2023-04-03 09:55:46 |
에러 내용
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (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.)
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
Caused by: java.sql.SQLException: 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.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: 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.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
'IT Business' 카테고리의 다른 글
java.lang.IllegalStateException: STREAMED (0) | 2023.04.11 |
---|---|
SHA512-Base64 변환기 (0) | 2023.04.10 |
Resource specification not allowed here for source level below 1.7 (0) | 2022.11.03 |
tomcat ssl연결 keystorepass 암호화 (0) | 2021.08.01 |
사설인증서 생성 시 alternative names 설정 오류 (0) | 2021.07.26 |