异常详情:
org.springframework.jdbc.cannotgetjdbcconnectionexception: could not get jdbc connection; nested exception is java.sql.sqlexception: connections could not be acquired from the underlying database!
分析:
这个异常的起因可能有很多种,网上也有很多对应的解决方案,尝试了很多,始终没有得到解决。
解决方案:
最后发现原因有二:
一是在Spring配置c3p0连接池过程中,jdbcUrl的值没有配置时区,即:jdbc:mysql://localhost:3306/test
应该是:jdbc:mysql://localhost:3306/test?serverTimezone=GMT
二是数据库的驱动包和数据库的版本不能相差太大
**教训:**花了那么长的时间,居然发现又是时区这个坑,第二次跳进这个坑了,必须长记性了(心塞)