Connecting DBeaver to a Heroku Postgres Database

I recently started using DBeaver to connect to postgres databases, both local and remote.

Most of my production databases are currently on Heroku. The process of linking DBeaver to a Heroku Postgres database was fairly straightforward, with the exception of an SSL setting that is not very intuitive. I wanted to document these steps here for others trying to achieve the same thing.


Find your Heroku Database Credentials

The exact steps are slightly different based on whether you are using a hobby or pro Postgres Addon, but the idea is the same.

  1. Go to your Heroku App
  2. Click on the Heroku Postgres Addon
  3. Go To Settings + Credentials

Heroku Postgres Addon

 

 

 

 

 

 

 

 

 

Create New Connection in DBeaver

  1. Open the New Connection Wizard
  2. Select PostgresSQL as your Connection Type and click Next
  3. Fill out the Host, Database, Port, User, and Password fields to match the Heroku Credentials
    Note: At this point, if you click Test Connection, you will see the connection fails with this message: “FATAL: no pg_hba.conf entry for host “X”, user “Y”, database “Z”, SSL off”  – we will need to go through one more step to setup SSL.
  4. Click Next on the Connection Wizard Prompt
  5. Go to the SSL Tab
  6. Check Enable SSL
  7. Set the SSL Factory to org.postgresql.ssl.NonValidatingFactory
  8. Test Connection again – it should now return “Success”
  9. Click Finish, and your DBeaver Connection to your Heroku Postgres Database should be all set

Thanks to cjunge-work for providing the answer in this issue

New DBeaver Connection

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Enter Heroku Credentials

 

 

 

 

 

 

 

 

 

 

 

 

DBeaver SSL Failure

 

 

 

 

 

 

 

 

 

 

 

SSL Config

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DBeaver Connection Success

 

 

 

 

 

 

 

 

 

 

Finish Connection

 

 

 

 

 

 

 

 

 

 

 

 

 

Connection Working

Leave a Reply