我已经按照https://docs.microsoft.com/en-us/azure/postgresql/connect-java的指示在Azure上创建了一个Postgres数据库。现在,我可以通过本地PgAdmin连接到数据库,也可以通过psql
从终端连接到数据库。然而,当我试图在我的java代码(java 8)中连接Hibernate (版本5.4.21)时,我总是在没有任何解释的情况下得到以下错误。
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
我尝试了不同的SSL模式选项,但没有成功。我也从Azure端禁用了SSL,但仍然没有成功。有人能帮我解决这个问题吗?
发布于 2020-09-23 21:57:16
我们在42.2.15
版本的驱动程序上也遇到了同样的问题。尝试设置
gssEncMode=disable
阅读更多:https://gitmemory.com/issue/pgjdbc/pgjdbc/1868/683710515
https://stackoverflow.com/questions/64016297
复制相似问题