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

时间:2021-03-22 23:09:41

I know these types of questions are already there but provided solution is not working for me.In my application there is no version mismatch b/w driver and PostgreSQL server. I have not found any other solution for this.

我知道这些类型的问题已经存在,但提供的解决方案对我不起作用。在我的应用程序中,没有版本不匹配的b/w驱动程序和PostgreSQL server。我还没有找到其他的解决方法。

I am using PostgreSQL server 9.4 and postgresql-9.4-1201.jdbc4.jar.

我使用的是PostgreSQL server 9.4和PostgreSQL -9.4-1201.jdbc4.jar。

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="org.postgresql.Driver"></property>
    <property name="username" value="postgres"></property>
    <property name="password" value="root"></property>
    <property name="url" value="jdbc:postgresql://localhost:5432/myapp"></property>
</bean>

pg_hba.conf is as follows:

pg_hba。配置如下:

host    all             all             127.0.0.1/32            md5
host    all             all             ::1/128                 md5

postgresql.conf is as follows

postgresql。配置如下

listen_addresses = '*'
port = 5432         
max_connections = 100

I have also check the netstat o/p .

我还检查了netstat o/p。

TCP    [::]:5432              [::]:0                 LISTENING
TCP    127.0.0.1:5432         0.0.0.0:0              LISTENING

Thanks

谢谢

1 个解决方案

#1


3  

I have faced the same issue.
Just change the port number 5432 to 5433 at postgresql.conf.
Restart your system.

我也遇到过同样的问题。在postgresql.conf中更改端口5432到5433。重新启动您的系统。

postgresql.conf file location in windows: C:\Program Files\PostgreSQL\9.4\data

postgresql。conf文件的位置在windows: c:)的程序文件。

Hope it will help you.

希望它能帮到你。

#1


3  

I have faced the same issue.
Just change the port number 5432 to 5433 at postgresql.conf.
Restart your system.

我也遇到过同样的问题。在postgresql.conf中更改端口5432到5433。重新启动您的系统。

postgresql.conf file location in windows: C:\Program Files\PostgreSQL\9.4\data

postgresql。conf文件的位置在windows: c:)的程序文件。

Hope it will help you.

希望它能帮到你。