• Post Reply Bookmark Topic Watch Topic
  • New Topic

Exception: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect'  RSS feed

 
John Paterson
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,

I am following the tutorial in this URL: http://www.codejava.net/frameworks/hibernate/writing-a-basic-hibernate-based-program-with-eclipse?showall=&start=9

I have set up everything as per instructions on that page, however when I run the application, I get the following error:
Exception in thread "main" org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set

Hope someone can advise. Thanks.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the entire exception stacktrace as well as the persistence.xml (or hibernate.cfg.xml) file contents. I had a quick look at that page you linked and didn't find the configuration file being used.
 
John Paterson
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran Pai,

Thanks for the message, the hibernate-cfg.xml file is as follow:



The exception stack trace is as follow:


Hope you can advise. Thank you.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The real problem appears to be this one:

WARN: HHH000342: Could not obtain connection to query metadata : Access denied for user 'root'@'localhost' (using password: YES)


It looks like the user/pass to connect to the database isn't working.
 
John Paterson
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran,

Thanks for the message. The password in the following line:

is wrong. I have replaced it with the correct one. The connection is fine now.

regards
John
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!