Connections could not be acquired from the underlying databa
阿新 • • 發佈:2018-11-12
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow
也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!
從基礎資料庫,無法獲取連線,無法連線到資料庫。
嚴重: StandardWrapper.Throwable
org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:372)
at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:417)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at com.xinghe.base.service.PlatformManager EnhancerBySpringCGLIB EnhancerBySpringCGLIB 9ad1dc7.getPlarMark(<generated>)
at com.xinghe.base.web.init.BaseDataServlet.init(BaseDataServlet.java:73)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5210)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5493)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
以上問題可能有一下原因造成:
1、驅動配置有誤:driver=com.mysql.jdbc.Driver
2、資料庫連線地址有誤:url=jdbc:mysql://localhost:3306/test?3useUnicode=true&characterEncoding=utf8
3、密碼或帳號有誤:username=root,password=root
4、資料庫未啟動或無權訪問
5、專案未引入對應的驅動jar包mysql-connector-java-5.1.6-bin.jar
6、mysql root沒有遠端訪問的許可權,需要增加許可權:
請參考:CentOS6.5下通過Shell修改MySQL初始密碼,開啟遠端登入,授權遠端登入使用者
7、防火牆原因
請參考:連線MySQL錯誤:Can't connect to MySQL server (10060)