首批通过分布式安全可靠测评,为关键业务系统打造
SQL 报错时区无法解析
更新时间:2026-05-29 08:46
问题描述
OceanBase Connecotr/JDBC 驱动报错。
The server time_zone 'GMT+8:00' cannot be parsed:
The server time_zone 'GMT+8:00' cannot be parsed. The server time zone must defined in the jdbc url string with the 'serverTimezone' parameter (or server time zone must be defined explicitly with sessionVariables=time_zone='Canada/Atlantic' for example). See java.util.TimeZone#getAvailableIDs() for available TimeZone, depending on your JRE implementation.
问题原因
对应租户的 time_zone 变量设置错误(GMT+8:00),正常设置显示如下。
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| time_zone | +8:00 |
+---------------+-------+
适用版本
OceanBase 数据库 V2.x、V3.x 版本。
解决方法
修改租户时区。
obclient > set global time_zone='+08:00';