16

How should I configure RubyMine jdbc datasource to remotely connect to Heroku's PostgreSQL database? Currently I am using such connection URL:

jdbc:postgresql://ec2-54-197-241-67.compute-1.amazonaws.com/dbqi9t12t5035q

but I get error about lack of entry for host '62.87.242.2' in pg_hba.conf. I am pretty sure that user and password are correct, because it runs online... :-). Could you help me?

Thank you in advance!

Kerozu
  • 673
  • 5
  • 15

2 Answers2

41

In the Advanced tab, there are a bunch of properties. Set the following properties:

ssl -> true
sslfactory -> org.postgresql.ssl.NonValidatingFactory
Logan B.
  • 784
  • 5
  • 12
  • I was having trouble connecting to any remotes, and this helped. – Michael Dec 03 '15 at 18:19
  • There was 3rd setting I've been missing in addition to the 2 above: `sslmode -> verify-ca`. https://www.jetbrains.com/help/ruby/how-to-connect-to-heroku-postgres.html – mrt Jan 23 '23 at 14:39
1

The error you're seeing means the security policy of the Postgres server doesn't allow the connection. Heroku Postgres only allow connections from within Heroku, as far as I know.

You'll need to use their official command line tools if you want to open a remote database connection:

heroku pg:psql

The official tools authenticate to Heroku and tunnel through their network.

Winfield
  • 18,985
  • 3
  • 52
  • 65