SSM jdbc报错 Cannot create PoolableConnectionFactory

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: 
Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException:
 Cannot create PoolableConnectionFactory 
 (The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. 
 You must configure either the server or JDBC driver (via the serverTimezone configuration property)
  to use a more specifc time zone value if you want to utilize time zone support.)

无法解析时区,在URL后追加上serverTimezone=UTC

<bean id="" class="">
	<property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
	<property name="url" value="jdbc:mysql://localhost:3306/mytest?serverTimezone=UTC"></property>
	<property name="username" value="root"></property>
	<property name="password" value="123456"></property>
</bean>
发布了55 篇原创文章 · 获赞 30 · 访问量 9840

猜你喜欢

转载自blog.csdn.net/chaifang0620/article/details/99617806