Hello everyone, you need to connect to a remote PostgreSql via IntellijIdea and PgAdmin3 , everything is the same there, but I just can't connect.

I have: ip remote server, login , password . There is also a database name , user name , and password .

Through the terminal doing all the actions manually, I connect, but I don’t really want to connect all the time through the console. I think it is adequate to use the appropriate means for the connection.

Here are the data entry forms for the connection:

db connect enter image description here ssh tunnel enter image description here

and mistake

enter image description here

There is one more parameter in the settings of the connection in pom.xml, server-url , but I’ll manually stop without it.

  • see if you can do the same thing “manually”: ru.stackoverflow.com/a/466274/178576 - aleksandr barakin
  • psql: 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 63333? But I step by step manually. I can write how to do it. - JAVAvladuxa
  • Is telnet not connecting too? neither on the server to port 5432, nor locally to port 63333 after the launch of the tunnel? - aleksandr barakin
  • apparently connected Trying <my ip> Connected to <my ip> Escape character is '^]'. SSH-2.0-OpenSSH_6.0p1 Debian-4 + deb7u2. Why is the server port 5432 I use 22, I thought 5432 port for connection to the base - JAVAvladuxa
  • With the -L локальный-порт:localhost:удалённый-порт option -L локальный-порт:localhost:удалённый-порт you are creating a tunnel. when accessing the локальный-порт on the local machine (telnet or psql program or any other), connection to the удалённый-порт will be performed on the remote machine. - aleksandr barakin

1 answer 1

Faced the same problem. I decided to do the following: I need to make changes to the configuration file ( postgresql.conf ) in terms of listening to port 5432 on a remote server:

 # - Connection Settings listen_addresses = '*' 

By default, the PostgreSQL database server listens to this port only locally ( listen_addresses = 'localhost' ).

At the same time, the configuration file pg_hba.conf is as follows:

 # "local" is for Unix domain socket connections only local all all ident # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5 # Others host all all 0.0.0.0/0 md5 

enter image description here

  • listen_addresses = '*' - these are so funny! I strongly recommend against using the answer. - aleksandr barakin