java.sql.SQLException: Connections could not be acquired from the underlying database!

  • 今天学习连接池c3p0遇到这个错误 java.sql.SQLException: Connections could not be acquired from the underlying database!
    java.sql.SQLException: Connections could not be acquired from the underlying database!

  • 刚开始还以为是c3p0-config.xml 配置有问题 看了半天没错 之后又以为是mysql版本的问题 于是去更改mysql的版本 发现还是这个错误

  • 在仔细看看这个错误Connections could not be acquired from the underlying database!
    无法获取database 然道是没有找到配置文件? 不对啊 我明明放在包下面
    java.sql.SQLException: Connections could not be acquired from the underlying database!

  • 于是我尝试着把配置文件放在src根目录下面

  • java.sql.SQLException: Connections could not be acquired from the underlying database!

  • 再次运行
    java.sql.SQLException: Connections could not be acquired from the underlying database!

  • 结果 居然成功了!

  • 哈哈 原来c3p0指定读取配置文件的位置是在src根目录下面