问答详情
源自:3-5 mapper的编写

无法获取数据库连接

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 [C:\Users\菲菲\IdeaProjects\test\target\classes\mapper\AreaDao.xml]

### The error may involve com.example.test.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!


提问者:qq_奥古斯都_1 2018-07-20 14:55

个回答

  • qq_慕神4321290
    2018-11-18 02:06:15

    jdbc.driverClass   = com.mysql.cj.jdbc.Driver

    jdbc.url      = jdbc:mysql://127.0.0.1:3306/db?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT



  • 赵丽颖No_11207
    2018-09-05 23:42:26

    1. 你可以先看看你的数据库url配置是否少了数据库名

    2. 或者你的配置缺少了什么,比如空格,单词,或者末尾是不是多了个空格

    3. 如果你的数据库是mysql-connector-java 6.0.x版本,driver是com.mysql.cj.jdbc.Driver