Failed to obtain JDBC Connection

来源:3-6 dao层开发

千层酥油饼

2018-12-27 17:28

nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database 碰到这个问题的同学,可以试试:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>5.1.44</version>
</dependency>

加上版本号就可以了

写回答 关注

4回答

  • 慕婉清9024742
    2020-05-31 23:18:02

    我的是版本太新了 ,默认是

    2.1.2.RELEASE 改为2.0.2.RELEASE 就好了
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>


  • 慕雪0535062
    2018-12-29 11:28:15

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 

    ### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!

    ### The error may exist in file [E:\ideaworkspace\demo\target\classes\mapper\AreaDao.xml]

    ### The error may involve com.imooc.demo.dao.AreaDao.queryArea

    ### The error occurred while executing a query

    ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!


    慕雪0535... 回复为了永无止境...

    <artifactId>mysql-connector-java</artifactId>这个包我就没改版本,让他使用自动的 <artifactId>c3p0</artifactId>这个包的版本我用的是<version>0.9.5.2</version>

    2019-01-07 17:08:21

    共 3 条回复 >

  • 慕雪0535062
    2018-12-29 11:27:46

    改了也没有用啊,这个问题卡了好久,网上还说改jdbc.driver=com.mysql.jdbc.Driver,然后还是这个问题

  • 千层酥油饼
    2018-12-27 17:28:26

    已解决。

    qq_北部湾...

    怎么解决

    2019-01-07 01:17:43

    共 1 条回复 >

SpringBoot+MyBatis搭建迷你小程序

SpringBoot+MyBatis搭建小程序后台

92306 学习 · 657 问题

查看课程

相似问题