DataGrip 2019.2 Help

How to connect to Heroku Postgres without SSL validation

If you want to connect to Heroku Postgres, create a data source connection that correspond to the data source vendor. In this case, you plan to work with PostgreSQL, so you need to create a connection to PosgreSQL. DataGrip already include the necessary JDBC driver.

Heroku Postgres requires you to use SSL for the connection. But for establishing a successful SSL connection, you need a certificate that you must upload to your Heroku application. SSL certificates are specific for each Heroku application. To configure these certificates, see the article about Heroku SSL.

If you do not plan to add the certificate in the keystore, you can bypass the server validation with the NonValidatingFactory option and establish an encrypted connection.

  1. In your Heroku account, create an application with the Heroku Postgres add-on.

  2. In settings of the Heroku Postgres add-on, get the database credentials.

  3. Navigate to File | Data Sources Ctrl+Alt+S.

  4. In the Data Sources and Drivers dialog, click the Add icon (The Add icon) and select PostgreSQL.

  5. At the bottom of the data source settings area, click the Download missing driver files link.

  6. In data source settings, click the Advanced tab and change values of the following properties:

    • ssl: true
    • sslfactory: org.postgresql.ssl.NonValidatingFactory

  7. In Host, Database, User, Password, and Port fields, specify connection details that you received for the Heroku Postgres add-on.

  8. To ensure that the connection to the data source is successful, click Test Connection. If you forgot to download JDBC drivers previously, you can click the Download Driver Files button in the notification dialog during the connection test.

Integration with Heroku Postgres
Last modified: 21 August 2019