org.postgresql.util。PSQLException:协议错误。会话设置失败

时间:2021-10-17 02:18:17

i am trying to connect to a postgresql server 9.3 running in my local machine.

我正在尝试连接到本地机器上运行的postgresql服务器9.3。

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.3-1100-jdbc41</version>
    </dependency>

Also tried above jar for Driver class.

也尝试了上面的jar驱动类。

Caused by: org.postgresql.util.PSQLException: Protocol error. Session setup failed. 
  at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:510) 
  at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:173)
  at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) 
  at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136) 
  at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)

resulted in above exception. any idea how to ge around this problem?

导致上述例外。你知道怎么解决这个问题吗?

1 个解决方案

#1


1  

the versions are correct. There was a typo in my connection string. the port given was wrong. After specifying the port, connection created successfully.

版本是正确的。我的连接字符串有一个错误。这个港口是错的。在指定端口之后,连接成功创建。

#1


1  

the versions are correct. There was a typo in my connection string. the port given was wrong. After specifying the port, connection created successfully.

版本是正确的。我的连接字符串有一个错误。这个港口是错的。在指定端口之后,连接成功创建。