Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection
Posted 南淮北安
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection相关的知识,希望对你有一定的参考价值。
文章目录
一、问题
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException:
Failed to obtain JDBC Connection; nested exception is java.sql.SQLException:
The server time zone value '�й���ʱ��' is unrecognized or represents more than one time zone.
二、解决
原因:mysql8要求必须设置时区
解决方案:
加上红色框里的值,设置时区
三、扩展
因为使用springboot,它强制将驱动设置成了MySQL8的,所以可能还会有一个建议:
Loading class `com.mysql.jdbc.Driver'. This is deprecated.
The new driver class is `com.mysql.cj.jdbc.Driver'.
The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
解决方案:
以上是关于Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection的主要内容,如果未能解决你的问题,请参考以下文章