Turn: Use the latest version of MySQL's jdbc driver for problems caused by time zones

Caused by: java.sql.SQLException: The server time zone value... 

Reason:  
    When using the latest version (6.0+) of mysql's jdbc driver, I encountered a problem caused by the difference between the time zone of the database and the system.  

Solution:  
    One is to downgrade the version, which we know and it is not recommended; the other is to add serverTimezone=UTC or GMT to the url of the jdbc connection. If you specify the use of gmt+8 time zone, you need to write it as GMT %2B8, otherwise a parsing to null error may be reported. An example is as follows: 

jdbc.url=jdbc:mysql://localhost:3306/demo?serverTimezone=UTC&characterEncoding=utf-8

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326446502&siteId=291194637