I am getting the following error when using Hibernate:
'hibernate.dialect' must be set when no Connection available
And I am using a datasource for database connection.
You will get this issue even if you have your configuration files having proper value but you don't configure it in the code.
I was explaining hibernate, I forgot to use configure()
before buildSessionFactory()
so I was getting the error.
You might want to recheck it.
Previous code which was giving me error
SessionFactory factory = new Configuration().buildSessionFactory();
Changed code No Error
SessionFactory factory = new Configuration().configure().buildSessionFactory();
The issue could be that you haven't installed the client library for the database you are trying to connect to.
I have a Spring application that does not have a persistence.xml file and therefore no hibernate.dialect declaration.
Once I installed the MySQL Connector/J client library the error went away.
EDIT: I've also gotten this error when the database server wasn't running. Something that often happens now that I run my MySQL server through MAMP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With