jdbc connection problems mysql database time zone

 

When using mysql-connector-java 8 above, the time zone difference of 13 hours. Database with native code test time is no problem.

Solutions, set the time zone, use the Asia / Shanghai solve the problem, the first two parameters are encoded in the data set, or Chinese stores will be messy, therefore solve the problem.

Database-driven com.mysql.jdbc.Driver obsolete recommended com.mysql.cj.jdbc.Driver

?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai

 

Guess you like

Origin www.cnblogs.com/sunjie-one/p/11905904.html