關於報錯:java.sql.SQLException: Access denied for user 'as'@'localhost' (using password: YES)


 

記個小細節

java.sql.SQLException: Access denied for user 'as'@'localhost' (using password: YES)

 

之所以出現這個錯誤是因為在db.properties中寫了username=xxx

 

username這個變量好像被jvm環境占用了,所以在applicationContext.xml中${username}取值得到的是jvm中username的值,

而不是db.properties中username的值,因此無法訪問數據庫

 

所以,在db.properties的username只要不寫成username,解決問題。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM