user2054833
user2054833

Reputation: 2165

Error connection to herokupostgresql locally

I am writing a struts2 app and using hibernate for persistence. I deploy may app on heroku and everything works ok, but when ever I run it locally I get:

 org.postgresql.util.PSQLException: FATAL:no pg_hba.conf entry for host "xx.xx.xxx.xxx", user "someuser", database "somedatabase", SSL off

I know the problem is I need to connect to the database over ssl but how can I set this up locally?

Upvotes: 2

Views: 823

Answers (2)

ryanbrainard
ryanbrainard

Reputation: 6067

Add this to the end of your JDBC connection URL:

?ssl=true&sslfactory=org.postgresql.ssl.NonValidatingFactory

Upvotes: 5

Craig Ringer
Craig Ringer

Reputation: 325051

The key here is "SSL off".

You must use SSL to connect to Heroku. How to enable it depends on the client you are using, which I'm guessing is PgJDBC since you're using Java and Hibernate.

The SSL section of the manual for PgJDBC covers what you need.

Upvotes: 2

Related Questions