org.postgresql.util.PSQLException: Protocol error. Session setup failed

社会主义新天地 提交于 2019-12-13 01:08:56

问题


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.

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 is as follows:

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

postgresql.conf is as follows

listen_addresses = '*'
port = 5432         
max_connections = 100

I have also check the netstat o/p .

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

Thanks


回答1:


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

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

Hope it will help you.



来源:https://stackoverflow.com/questions/31091471/org-postgresql-util-psqlexception-protocol-error-session-setup-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!