2015-03-19 113 views
0

你好我米仍然是新的春季和冬眠它是我的第一個應用程序嘗試連接到數據庫,但我得到這個除外HTTP狀態500 - 請求處理失敗;嵌套異常是org.hibernate.exception.GenericJDBCException:無法在控制檯中打開連接 :org.hibernate.exception.GenericJDBCException:無法打開具有根本原因的連接] java.sql.SQLException: 拒絕用戶'root'的訪問@ '本地主機'(使用密碼:是) 任何人都可以幫助我PLZ我cheched與其他Java應用程序的連接,它完美的工作!org.hibernate.exception.GenericJDBCException:無法打開連接]與根本原因java.sql.SQLException:

database.properties

database.driver=com.mysql.jdbc.Driver 
    database.url=jdbc:mysql://localhost:3306/DAVDB 
database.user=root 
database.password='' 
hibernate.dialect=org.hibernate.dialect.MySQLDialect 
hibernate.show_sql=true 
hibernate.hbm2ddl.auto=update 

回答

0

你database.properties是不正確的:

database.password='' 

應該是:

database.password= 

假設你想要一個空密碼。行情在屬性文件中沒有特殊含義,所以它們將被視爲文字。

+0

謝謝你的回答我改變它作爲你的建議,但現在得到一個新的異常「請求處理失敗;嵌套的異常是org.hibernate.exception.SQLGrammarException:無法打開連接」其實II米混淆研究後有建議以chech hibernate.cfg文件但我沒有,我甚至不知道它是什麼! – user3908325 2015-03-19 11:48:29

+0

我沒有在Spring中使用Hibernate,所以我不確定什麼是正確的方式。也許這個問題可以幫助你:http://stackoverflow.com/questions/19876147/integration-of-hibernate-with-spring-avoid-duplication-of-connection-parameters – Petter 2015-03-19 12:56:09

+0

非常感謝你的幫助:) – user3908325 2015-03-19 14:05:01

相關問題