Help Center/ Distributed Database Middleware/ FAQs/ General Questions/ What Do I Do If My Database Time Is 13 or 14 Hours Later than Beijing Time?
Updated on 2022-06-06 GMT+08:00

What Do I Do If My Database Time Is 13 or 14 Hours Later than Beijing Time?

Symptom

If GMT+8:00 is used in your database, your database time is 13 or 14 hours later than Beijing time when you connect to your DDM instance using JDBC.

Possible Cause

If you connect to a DDM instance using JDBC, JDBC queries the database time zone of the instance and DDM returns China Standard Time UTC+08:00 to JDBC.

CST has the following meanings:

  • Central Standard Time (USA) UTC-06:00
  • Central Standard Time (Australia) UTC+09:30
  • China Standard Time UTC+08:00
  • Cuba Standard Time UTC-04:00

The JDBC driver parses CST as Central Standard Time (USA) UTC-06:00, which is 13 or 14 hours later than Beijing time.

Solution

Add time zone configurations in the JDBC address:

jdbc:mysql://xxx:3306/database_name?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8