org.postgresql.util.PSQLException:协议错误。会话设置失败 [英] org.postgresql.util.PSQLException: Protocol error. Session setup failed

查看:2730
本文介绍了org.postgresql.util.PSQLException:协议错误。会话设置失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

我正在使用PostgreSQL服务器9.4和postgresql-9.4-1201.jdbc4.jar。

I am using PostgreSQL server 9.4 and 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如下:

pg_hba.conf is as follows:

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

postgresql.conf如下

postgresql.conf is as follows

listen_addresses = '*'
port = 5432         
max_connections = 100

我还检查了netstat o / p。

I have also check the netstat o/p .

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

谢谢

推荐答案

我也遇到过同样的问题。

只需将 postgresql.conf 上的端口号5432更改为5433。

重新启动系统。

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

postgresql.conf 在Windows中的文件位置: C:\Program Files\PostgreSQL\9.4\data

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

希望它会对您有所帮助。

Hope it will help you.

这篇关于org.postgresql.util.PSQLException:协议错误。会话设置失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆