JetBrains Rider 2024.3 Help

Create a PostgreSQL data source for Heroku Postgres without SSL validation

Enable the Database Tools and SQL plugin

This functionality relies on the Database Tools and SQL plugin, which is bundled and enabled in JetBrains Rider by default. If the relevant features are not available, make sure that you did not disable the plugin.

  1. Press Ctrl+Alt+S to open settings and then select Plugins.

  2. Open the Installed tab, find the Database Tools and SQL plugin, and select the checkbox next to the plugin name.

If you want to connect to Heroku Postgres, create a data source connection that corresponds to the data source vendor. In this case, you plan to work with PostgreSQL, so you need to create a connection to PostgreSQL. JetBrains Rider 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 have to 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 the settings of the Heroku Postgres add-on, get the database credentials.

  3. In the Database tool window ( View | Tool Windows | Database) , click the New icon New and select Connect to Database.

  4. If you have a connection string for the database defined in your solution or elsewhere, leave the Use connection string option selected and choose PostgreSQL in the Database type selector.

    Use the String selector to choose the desired connection string from your solution or type it in manually, then click Connect.

  5. You can also choose Add data source manually, click Next and select PostgreSQL in the Database source selector. Follow the wizard steps to form the connection string by configuring individual options.

  6. To access all available options for the new database connection, click in the Database window, then click the New icon New and select PostgreSQL.

  7. Check if there is a Download missing driver files link at the bottom of the connection settings area. Click this link to download drivers that are required to interact with a database. For a direct download link, refer to the JetBrains JDBC drivers page.

    Location for the downloaded JDBC drivers is the JetBrains Rider configuration directory.

    The Download missing driver files link

    You can also use your drivers for the database instead of the provided ones. For more information about connecting to a database with your driver, refer to Add a user driver to an existing connection.

    If there is no Download missing driver files link, then you already have the required drivers.

  8. Specify the database connection details. Alternatively, paste the JDBC URL in the URL field.

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

    For the reference information about on the General and other tabs of Data Sources and Drivers dialog (Shift+Enter) , see .

  9. In the SSH/SSL tab of Data Sources and Drivers dialog, select the Use SSL checkbox.

  10. In the Advanced tab of Data Sources and Drivers dialog, change the value of the following property:

    • sslfactory:org.postgresql.ssl.NonValidatingFactory: to allow SSL connections without validating the server certificate.

  11. Ensure that the connection to the database can be established using the provided details. To do that, click the Test Connection link at the bottom of the connection details area.

    Test Connection link

    In case of any connection issues, refer to the Cannot connect to a database page.

  12. (Optional) By default, only the default database is introspected and available to work with. If you also want to work with other databases, in the Schemas tab, select them for the introspection.

    Schemas tab of the Data Sources and Drivers dialog
  13. Click OK to create the data source.

  14. Find your new data source in the Database tool window (⌘ 1) .

    • For more information about the Database tool window, see the corresponding reference topic.

    • For more information about working with database objects in JetBrains Rider, refer to Database objects.

    • To write and run queries, open the default query console by clicking the data source and pressing F4.

    • To view and edit data of a database object, open Data editor and viewer by double-clicking the object.

Integration with Heroku Postgres
Last modified: 29 August 2024