连接池(dbcp)连接mysql8时出现这样一个bug
java.sql.SQLException: 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.)
是因为在连接池中没有方法能直接设置时区
解决方法
1.在连接url中添加serverTimezone=UTC
即:url=jdbc:mysql://localhost:3306/gk?serverTimezone=UTC
2.使用数据库管理工具直接设置mysql数据库的时区
解决方法来源于:连接池C3P0连接MySQL 8 问题: 'serverTimezone' is not writable or has an invalid setter method - 程序员大本营