问题:
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 com/ssmbuild/dao/BookMapper.xml
### The error may involve com.ssmbuild.dao.BookMapper.queryAllBook
### 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!
解决:
尝试了很多方法,最后还是url的问题:
原有的:
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/ssmbuilduseSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=CST
jdbc.username=root
jdbc.password=***
现在的:
jdbc.url=jdbc:mysql://localhost:3306/ssmbuild?characterEncoding=utf-8&serverTimezone=GMT
就可以连接成功啦