第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

鏈接不上數(shù)據(jù)庫,有沒有人能幫忙呀,謝謝啦!~


因為我的root是默認有密碼的,所以我在jdb.properties中進行了這樣的設置

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/seckill?useUnicode=true&characterEncoding=utf-8
jdbc.user=root
jdbc.password=111000

然后發(fā)現(xiàn)在test的時候報錯,請問有沒有誰知道怎么解決呀,謝謝!



報錯是這樣的=?=

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: An attempt by a client to checkout a Connection has timed out.
### The error may exist in file [C:\Users\j00464179.CHINA\seckill\target\classes\mapper\SeckillDao.xml]
### The error may involve org.seckill.dao.SeckillDao.queryById
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.

?at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:76)
?at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:399)
?at com.sun.proxy.$Proxy13.selectOne(Unknown Source)
?at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:165)
?at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:69)
?at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:53)
?at com.sun.proxy.$Proxy14.queryById(Unknown Source)
?at org.seckill.dao.SeckillDaoTest.queryById(SeckillDaoTest.java:35)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
?at java.lang.reflect.Method.invoke(Method.java:498)
?at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
?at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
?at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
?at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
?at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:73)
?at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)
?at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)
?at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
?at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:224)
?at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
?at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
?at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
?at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
?at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
?at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
?at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
?at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
?at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
?at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
?at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
?at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
?at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
?at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
?at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.? Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
### The error may exist in file [C:\Users\j00464179.CHINA\seckill\target\classes\mapper\SeckillDao.xml]
### The error may involve org.seckill.dao.SeckillDao.queryById
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
?at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
?at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:122)
?at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:113)
?at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:73)
?at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
?at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
?at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
?at java.lang.reflect.Method.invoke(Method.java:498)
?at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:386)
?... 34 more
Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
?at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)
?at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82)
?at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68)
?at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:315)
?at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:75)
?at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:61)
?at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:303)
?at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:154)
?at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:102)
?at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:82)
?at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:120)
?... 41 more
Caused by: java.sql.SQLException: An attempt by a client to checkout a Connection has timed out.
?at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
?at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65)
?at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:527)
?at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
?at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
?at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
?... 51 more
Caused by: com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@2ca65ce4 -- timeout at awaitAvailable()
?at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1317)
?at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
?at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
?at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
?... 54 more

正在回答

2 回答

1.首先確認連接參數(shù)有沒有錯誤。比如將localhost改為127.0.0.1,端口是不是默認的3306
2.spring-dao.xml中的獲取連接超時時間設置有沒有問題。會不會設置成了 1 (毫秒)

0 回復 有任何疑惑可以回復我~
#1

我就是來AC的 提問者

謝謝,問題解決了,是因為數(shù)據(jù)庫版本太高了,用的8.0.11,應該是更新了安全連接之類的措施,我降版本到5.x之后就好了
2018-08-08 回復 有任何疑惑可以回復我~
#2

Java是好玩就是 回復 我就是來AC的 提問者

我今天遇到的相同報錯是因為。。。昨天瘋狂Ctrl + Z,安裝的MySQL直接消失了。。。哈哈哈
2018-08-08 回復 有任何疑惑可以回復我~

我今天也遇到同樣的錯誤了,報錯獲取連接超時,于是我將連接池獲取連接超時時間改為10秒鐘,再次執(zhí)行,發(fā)現(xiàn)報錯信息不一樣了,這次報的是?Connection refused: connect ,似乎是連不上數(shù)據(jù)庫,cmd窗口執(zhí)行mysql命令,發(fā)現(xiàn)無效,最后發(fā)現(xiàn)是mysql服務沒有啟動。
手動啟動mysql服務就好了。

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

鏈接不上數(shù)據(jù)庫,有沒有人能幫忙呀,謝謝啦!~

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號