2015-03-19 54 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

相关问题