1

I wrote a small app on Java and need to store data remotely. I registered on free host and created PostgreSQL database. When I go on PhpPgAdmin from host I see this. enter image description here

But how can I connect to this DB (from Intellij IDEA for example)?
What I need to write as host.

enter image description here EDITED enter image description here

Dmitry
  • 93
  • 1
  • 11

2 Answers2

1

If it's a remote host and you know the hostname, you can find out the ip to connect to (although you should be able to just specify the hostname). For example, from your local machine (assuming unix), you can run this in the terminal: host that_russian_string_that_I_assume_is_the_remote_host and that should give you the ip to connect to from intellij.

Thanos
  • 330
  • 2
  • 7
  • In EDITED of question I added image of my hosting. If I write this IP address as host I get Error: FATAL: no pg_hba.conf entry for host "178.94.207.167", user "cp319485_yapokupay", database "cp319485_yapokupay", SSL off – Dmitry Dec 15 '16 at 10:10
  • Ok, you shouldn't be able to connect to that db from terminal either then. E.g. `psql -h 178.94.207.167 -l -U cp319485_yapokupay` shouldn't work. If that's the case you need to request access, usually someone needs to add an entry in that pg_hba.conf file as it's previously suggested by Abzal. – Thanos Dec 15 '16 at 10:16
  • Where can I find file pg_hba.conf on remote DB? – Dmitry Dec 15 '16 at 10:18
  • If you can ssh to the remote host where the db is running then you can either connect to the db and ask for it's location. For example `show hba_file;`. If not and you're using linux, one possible location is: `/etc/postgresql/9.4/main/pg_hba.conf`. I'd have a read through https://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html on what needs adding. – Thanos Dec 15 '16 at 10:21
  • Sorry it'll be `/etc/postgresql/9.2...` in your case. – Thanos Dec 15 '16 at 10:21
1

You need to write IP address or Domain Name of your host.

Abzal Kalimbetov
  • 505
  • 7
  • 20
  • https://whm1.cpanelhosting.ru:2083/cpsess9500447457/frontend/paper_lantern/index.html is url of panel from I go to PhpPgAdmin. I tried to write whm1.cpanelhosting.ru as host but I got Error: FATAL: no pg_hba.conf entry for host "178.94.207.167", user "cp319485_yapokupay", database "cp319485_yapokupay", SSL off – Dmitry Dec 15 '16 at 10:04
  • Probably, you need to ask the Host Admin to open Postgresql port or if you have access, configure pg_hba.conf and postgresql.conf for remote access. In most hosts it is closed by default. It is open for only localhost access. – Abzal Kalimbetov Dec 15 '16 at 10:07
  • As I understand it can't be free? – Dmitry Dec 15 '16 at 10:10
  • Read please this article to configure postgresql for remote access: http://stackoverflow.com/questions/18580066/how-to-allow-remote-access-to-postgresql-database – Abzal Kalimbetov Dec 15 '16 at 10:13
  • In this article describes how to configure DB locatet on PC locally. Where can I find file postgresql.conf on remote DB? – Dmitry Dec 15 '16 at 10:17
  • if you have private VPN host, you would have access. Nevertheless, I quote my message: "you need to ask the Host Admin to open Postgresql port or if you have access, configure pg_hba.conf and postgresql.conf" – Abzal Kalimbetov Dec 15 '16 at 10:19