dao出错,好像无法连接数据库
来源:2-7 验证Dao

AKIRA_ZZH
2019-04-15
四月 15, 2019 4:19:44 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getDefaultTestExecutionListenerClassNames
信息: Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
四月 15, 2019 4:19:44 下午 org.springframework.test.context.support.DefaultTestContextBootstrapper getTestExecutionListeners
信息: Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@1e67b872, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@60addb54, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@3f2a3a5, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4cb2c100, org.springframework.test.context.transaction.TransactionalTestExecutionListener@6fb554cc, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@614c5515]
四月 15, 2019 4:19:44 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]
四月 15, 2019 4:19:44 下午 org.springframework.context.support.GenericApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.GenericApplicationContext@7dc7cbad: startup date [Mon Apr 15 16:19:44 CST 2019]; root of context hierarchy
四月 15, 2019 4:19:44 下午 com.mchange.v2.log.MLog
信息: MLog clients using java 1.4+ standard logging.
四月 15, 2019 4:19:44 下午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
The error may exist in file [D:\workplace\o2o\target\classes\mapper\AreaDao.xml]
The error may involve com.zzh.o2o.dao.AreaDao.queryArea
The error occurred while executing a query
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
请教下老师该怎么更正
3回答
-
同学好,我感觉是你用了mysql8而用的是mysql5的驱动。建议在没有类似解决问题的能力之前,还是先用目前市面依然主流的mysql5.x,否则要把c3p0和相关数据库jdbc版本调整到最新,并且后续mysql8在主从同步的grant语句语法也不一样
032019-04-16 -
AKIRA_ZZH
提问者
2019-04-15
我觉得有可能是我的spring-dao.xml中的配置出了问题
00 -
AKIRA_ZZH
提问者
2019-04-15
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
### The error may exist in file [D:\workplace\o2o\target\classes\mapper\AreaDao.xml]
### The error may involve com.zzh.o2o.dao.AreaDao.queryArea
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
这个是错误测试的报告,我认为应该是数据库没有连接成功,但是我也不知道哪里出了错误
012020-05-12
相似问题