title: Can not connect to Postgres database on Azure with Java
body: <p>I have created a Postgres database on Azure via following the instructions from <a href="https://docs.microsoft.com/en-us/azure/postgresql/connect-java" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/postgresql/connect-java</a>. Now I can connect to the database via my local PgAdmin and also from terminal with <code>psql</code>. 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.</p>
  <pre><code>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.&lt;init&gt;(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
  </code></pre>
  <p>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?</p>