SSM:出现Connections could not be acquired from the underlying database异常的解决
QUESTION:SSM:出現(xiàn)Connections could not be acquired from the underlying database異常的解決
ANSWER:
近期在學(xué)習(xí)ssm框架做小demo時(shí),配了半天的框架,好不容易解決了maven中的jar包錯(cuò)誤,現(xiàn)在運(yùn)行tomcat服務(wù)器時(shí)出現(xiàn)數(shù)據(jù)庫(kù)異常,頓時(shí)就感到頭疼。不過(guò)幸好,改了好長(zhǎng)時(shí)間終于解決了。
具體原因有好幾種:
1,驅(qū)動(dòng)配置有誤:
對(duì)于mysql:
driver=com.mysql.jdbc.Driver
對(duì)于oracle:
oracle.jdbc.driver.OracleDriver2,數(shù)據(jù)庫(kù)連接地址有誤:
對(duì)于mysql:
url=jdbc:mysql://localhost:3306/test?3useUnicode=true&characterEncoding=utf8
對(duì)于oracle:
jdbc:oracle:thin:@127.0.0.1:1521:orcl3,密碼或帳號(hào)有誤
(上面三條一般都寫(xiě)在配置文件中,如果是因?yàn)樾薷牧伺渲梦募髮?dǎo)致該錯(cuò)誤,建議重寫(xiě)一遍配置文件,因?yàn)橛袝r(shí)候開(kāi)發(fā)工具就是很蛋疼,表面沒(méi)有錯(cuò)誤,程序運(yùn)行卻提示報(bào)錯(cuò))
4,數(shù)據(jù)庫(kù)未啟動(dòng)或無(wú)權(quán)訪問(wèn)
5,項(xiàng)目未引入對(duì)應(yīng)的驅(qū)動(dòng)jar包
mysql-connector-java-5.1.6-bin.jar
或者
ojdbc6.jar這一點(diǎn)可以瀏覽博主博客:Maven:導(dǎo)入Oracle的jar包時(shí)出現(xiàn)錯(cuò)誤
6,mysql root沒(méi)有遠(yuǎn)程訪問(wèn)的權(quán)限,需要增加權(quán)限
增加權(quán)限的步驟如下:
進(jìn)入mysql數(shù)據(jù)庫(kù):
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
flush privileges;
7.SSM的xml文件有錯(cuò)誤,檢查并修正。
關(guān)于這點(diǎn)可以瀏覽博主博客:SSM:Maven整合ssm時(shí)的步驟
改正配置文件后,我的project正常運(yùn)行啟動(dòng)。
?
總結(jié)
以上是生活随笔為你收集整理的SSM:出现Connections could not be acquired from the underlying database异常的解决的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 论文阅读课3-GraphRel: Mod
- 下一篇: cosine_similarity和to