SSM时jdbc报错 Cannot create PoolableConnectionFactory (The server time zone value '�й���׼ʱ��' is unreco

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.

解法: 依照提示把驱动改为com.mysql.cj.jdbc.Driver即可,即使不改也可以运行正确, 只是会报错

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  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.)

解法: 无法解析时区, 这个不解决运行不出结果, 解决方法是在原来的语句后面加 " ?serverTimezone=UTC " 

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"></property>
    <property name="url" value="jdbc:mysql://"></property>
    <property name="username" value="root"></property>
    <property name="password" value="root"></property>

个人分类: java mysql
想对作者说点什么? 我来说一句