JDBC to PostgreSQL Not working since upgrading Ubuntu - postgresql

So I had PostgreSQL working in Ubuntu 11.04 using 8.4(?), however, when I upgraded it also upgraded PostgreSQL to 9.1 and now I can't connect using JDBC.
I added the following to my pg_hba.conf
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 trust
and the following to my postgres.conf...
listen_addresses = '*'
but I get the following connecting with SQuirrel
My Local PostgresSQL: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Any ideas?

Per this site the default port is 5432, however, per the postgres.conf file that came installed by default the port is set to 5433...
port = 5433
So if someone else has this problem try the new port.
I think it has to do with the install incrementing the port when it sees the existing 8.4

Perhaps a IPv4 vs IPv6 issue? Try adding this line
host all all ::1/128 trust
and try connecting to the hostname localhost.
If that's not a solution, please try md5 instead of trust and give the connecting user a password. Just to be sure to rule this out.

Related

Cannot connect to postgresql remotely

I cannot connect to my postgresql instance remotely on port 5432. Connection times out. I cannot connect remotely using psql, pgAdmin or telnet. I feel like I have everything configured correctly. Postgresql has been restarted several times with these settings. Remote connection works fine.
What could I be missing?
netstat:
postgressql.conf
pg_hba.conf:
Try referring this link for help
https://www.thegeekstuff.com/2014/02/enable-remote-postgresql-connection/?utm_source=tuicool
in short you have to the following steps
1. Add the following line to the pg_hba.conf server. This will allow connection from “192.168.xxx.xx” ip-address (This is the client ip)
# vi /var/lib/pgsql/data/pg_hba.conf
host all all 192.168.xxx.xx/xx trust
Change the Listen Address in postgresql.conf
# grep listen /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'
Test the Remote Connection
You just need to change the method md5 to trust and and enter the address as 0.0.0.0/0.
Open the config file
vi /var/lib/pgsql/data/pg_hba.conf
Insert the following line
host all all 0.0.0.0/0 trust
Maybe it will work.

Hosting on PostgreSQL 9.6 for windows 32 bit [duplicate]

From many days i'm trying to set the hosting on my postgreSQL. I try many solution but no one works. The version of my postgres is 9.6 for windows 32 bit with pgAdmin 4.
I've set in my pg_hba.conf with many type of option but non one work. Now it looks like this.
# IPv4 local connections:
host all all 127.0.0.1/32 #authmethodhost#
host all all 0.0.0.0/0 #authmethodhost#
# IPv6 local connections:
host all all ::1/128 #authmethodhost#
I've tried md5, trust.
thepostgresql.conf is already set like:
listen_addresses = '*'
I don't know how I can obtain the postgresql hosting
(the server work right in local host, the port is right set, the driver is installed).
This is the error message:
FATAL: no entry in pg_hba.conf for the guest "MY.IP.AD.DRS",
user "myadmin", "mydatabase" database, SSL is not enabled
Thanks.

TCP/IP Connections with Postgres on Virtual Server

I'm trying to connect my local gui for postgres to a virtual server that I have running postgres.
I can
su postgres_user
Then
pgsql
Here pgsql loads.
When I go to my pg_hba.conf I have
host all all x.x.x.x/24 trust
In postgresql.conf
listen_addresses = 'localhost,x.x.x.x'
I have ubuntu 16 and postgres 9.5
I have the issue when I try to connect I get the error:
could not connect to server: Connection refused...Is the server running on host "hostip" and accepting TCP/IP connections on port 5432.
If you are using linode, you must either whitelist your ip or use putty (in windows) to tunnel postgres to connect to it.
putty tunneling is easier, however more annoying to deal with on a day to day basis
Follow the tutorial here.
here
Note, it's the same for PGAdmin as it is for any gui in windows.

postgres server running in local host, but postico, pgadmin can't access to it

I successfully installed postgres through homebrew, and i set it run automatically by doing
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
So, right now i can access to psql from my terminal (i use iterm2 + oh my zsh)
psql (9.6.1)
Type "help" for help.
ty2kim=#
The problem is, postgres management tools like postico, pgadmin cannot access to it
for postico, error message is
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5435?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5435?
which is weird because from my understanding, accessing to the database from terminal and management tools are basically the same if configured correctly
My pg_hba.conf and postgresql.conf are set as default (didn't make any changes there), but i tried doing
listen_addresses = 'localhost'
=>
listen_addresses = '*'
(restart server)
still didn't work
Please help!
Port 5435 is not standard for PostgreSQL. Are you sure PG is running on it? If you didn't change it in postgresql.conf it must be 5432. Please check it.
must check pg_hba.conf. If there doesn't have much restriction, you can put to end of this file by below line:
host all all all trust
After that, reload/restart instance.
Check if your PC is using firewall. If yes, please turn off it.

Geoserver(VPS) connection to PostgreSql(localhost)

I am trying to connect Geoserver (installed in a VPS) to a PostgreSql database wich is running into my pc(localhost). I have follow the steps to allow this kind of connection(I do not know if all needed):
POSTGRESQL:
1.- Edit pg_hba.config of PostgreSql to allow Ip of VPS(Geoserver):
host all all ip_VPS/24 md5
2.- Edit postgresql.conf to allow remote connections:
listen_addresses ='*'
WINDOWS:
1.- Firewall configuration to allow Ip(VPS) access.
,but i still getting this connection error:
Unable to obtain connection: Cannot create PoolableConnectionFactory
(Connection to My_Ip(pc):5432 refused. Check that the hostname and
port are correct and that the postmaster is accepting TCP/IP
connections.).
Would i have to make other configuration ?.
Thanks in advance.
0k. You have in pg_hba.config:
host all all ip_VPS/24 md5
Maybe you should try this:
host all all ip_VPS/24 trust
Then you should restart postgres.
(For the parameter "trust" or "md5" I recommend reviewing:
www.postgresql.org/docs/9.5/static/auth-pg-hba-conf.html)
Greetings.