Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment] postgresql postgresql

Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]


Cause: The error occurred since hibernate is not able to connect to the database.
Solution:
1. Please ensure that you have a database present at the server referred to in the configuration file eg. "hibernatedb" in this case.
2. Please see if the username and password for connecting to the db are correct.
3. Check if relevant jars required for the connection are mapped to the project.


You don't need hibernate-entitymanager-xxx.jar, because of you use a Hibernate session approach (not JPA). You need to close the SessionFactory too and rollback a transaction on errors. But, the problem, of course, is not with those.

This is returned by a database

#org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sa"#

Looks like you've provided an incorrect username or (and) password.


Either you experienced database connection issue or you missed any of the hibernate configurations to connect to database such as database DIALECT.

Happens if your database server was disconnected due to network related issue.

If you're using spring boot along with hibernate connected to Oracle Db, use

hibernate.dialect=org.hibernate.dialect.HSQLDialecthibernate.show_sql=truehibernate.hbm2ddl.auto=updatehibernate.generate_statistics=trueentitymanager.packagesToScan: com