So, you have an app hosted on Heroku that uses Postgres as a database and you are looking for a way to connect to it? Well, you are in luck, this tutorial will walk you through how to connect to your PostgreSQL database on Heroku using standards based connectivity (ODBC and JDBC) from Progress DataDirect. Let’s get started.
You can get your Database URL using either Heroku CLI or from your Heroku dashboard.
Using Heroku CLI
- If you have Heroku CLI installed on your machine, then open your terminal/command prompt and run the following command
heroku config:get DATABASE_URL -a <your_heroku_app_name>
- When you run the above command, you will get your database URL in the following format.
postgres://<username>:<password>@<hostname/server>/<databasename>
Using Heroku Dashboard
- If you don’t have the Heroku CLI installed, no worries, you can still get your connection info by logging in to your Heroku Dashboard.
- Go to the Heroku application that you intend to connect to, click on the settings tab and in Config Variables section, and click on the button Reveal Config Vars as shown in the below screenshot.

- You should now see the list of configuration variables and copy the value of the key DATABASE_URL. It will be in the format of
postgres://<username>:<password>@<hostname/server>/<databasename>
- Note that this is not a recommended way of getting the database URL, if you want to use this in your application development, you should use the Heroku CLI for that. This is just a way for making it easy for users that are trying it out for the first time.