I have created a Postgres database on Azure via following the instructions from https://learn.microsoft.com/en-us/azure/postgresql/connect-java. Now I can connect to the database via my local PgAdmin and also from terminal with psql. However, when I try to connect with Hibernate (version 5.4.21) in my java code (java 8) I always get the following error without any explanations.
org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:315)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225)
at org.postgresql.Driver.makeConnection(Driver.java:465)
at org.postgresql.Driver.connect(Driver.java:264)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at test.ui.V9.main(V9.java:17)
Caused by: java.io.EOFException
at org.postgresql.core.PGStream.receiveChar(PGStream.java:443)
at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:436)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
... 7 more
I tried different SSL mode options but no success. I also disabled SSL from Azure side, but still no success. Can someone help me to resolve this issue?