Developing RoR app on Windows using RubyMine, trying to connect to Postgres database hosted on Heroku server. No Postgres installed locally. Getting "java.sql.SQLException: FATAL: no pg_hba.conf entry for host..." What to do, what to do?
2 Answers
This is due to Heroku databases needing additional SSL configuration. You need to enable SSL in your jdbc string by appending:
?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory
For details see Heroku's help document.
It looks like this is a RubyMine issue. RubyMine will convert the hostname to an IP address and pg_hba.conf includes the hostname but not the IP address hence the error. It works fine from the command line (e.g. rails s).
-
Getting this as well - any way to fix this rather than use the console? Commented Oct 21, 2013 at 13:15
-
No, and I haven't checked if this is a known bug for RubyMine. Commented Oct 23, 2013 at 10:58