解決Connections could not be acquired from the underlying database!的問題
阿新 • • 發佈:2019-02-08
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
做Spring+Mybatis的專案,報錯
jdbc.properies:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/seckill
username=root
password=root
spring-dao.xml:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${driver}"/> <property name="jdbcUrl" value="${url}"/> <property name="user" value="${username}"/> <property name="password" value="${password}"/>
如果不用jdbc配置檔案直接寫就可以。
最後發現是username的問題,好像改個名就可以,比如:usernamex=root
<property name="user" value="${usernamex}"/>