Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
遇到上面錯誤當然是先找到數據庫的配置文件了,如果你使用的是mysql新版本他的driver修改了新的 要改成
jdbc.driver=com.mysql.cj.jdbc.Driver
最后再檢查一遍用戶名和密碼以及url 就可以運行看看結果了。
要是還出現這個錯誤,就檢查下配置文件有沒有空間,如果你是用的c3p0連接池就檢查下你的寫法有沒有加上jdbc.xxx等其他參數,要是還不行你就檢查下你spring配置數據源的時候user是不是寫成了username,
要是還不行的話就把jar包版本改成5.0+,pom自己添加依賴即可,以上就是全部百度的方法了。
org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout() 錯誤解決
錯誤原因就是:mybatis和spring-mybatis版本不匹配
把版本號改成
3.4.1和1.3.1沒有錯誤
Handler dispatch failed; nested exception is java.lang.AbstractMethodError: Method com/mchange/v2/c3p0/impl/NewProxyPreparedStatement.isClosed()Z is abstract 錯誤解決
換個依賴
<!--c3p0數據源-->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.2</version>
</dependency>
最后再來一張成功圖

