Last updated June 10, 2026
Common Runtime databases are accessible from anywhere. Any application using Postgres clients can connect to these databases. The Postgres plans available on the Common Runtime are Essential, Advanced (Limited GA), Standard, and Premium.

Heroku Postgres Advanced is in limited general availability. To start creating and using Advanced databases, open a ticket with Heroku Support to request access. Subscribe to our changelog to stay informed of when Heroku Postgres Advanced is generally available.
Private and Shield-tier databases have restricted network access. See Connecting to a Private or Shield Heroku Postgres Database from an External Resource for details.
Access Database Credentials via Config Vars
Every Heroku Postgres database is provisioned to a Heroku app and has a corresponding config var that contains the database connection string. DATABASE_URL is the default name for this config var. The database URL includes the host, port, database name, username, and password needed to connect to the database.
Heroku automatically manages this config var and updates it when credentials change, such as during credential rotations.
To view your database’s config var, use the heroku config:get command:
$ heroku config:get DATABASE_URL -a example-app
postgres://username:password@host:port/database
You can also view all config vars in the Heroku Dashboard under your app’s Settings tab.
Connect via heroku pg:psql
To connect to your Heroku Postgres database from the Heroku CLI, use the heroku pg:psql command. The command uses your primary database at DATABASE_URL by default, but you can specify the database you want to connect to:
~ heroku pg:psql -a example-app
--> Connecting to ⛁ postgresql-shaped-79922
psql (17.2 (Postgres.app), server 17.9 (Ubuntu 17.9-1.pgdg20.04+heroku2))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off, ALPN: postgresql)
Type "help" for help.
example-app::DATABASE=>
heroku pg:psql is a wrapper for PostgreSQL’s native interactive terminal psql. If you don’t have the Heroku CLI installed, you can also connect your Heroku Postgres database directly with psql <DATABASE_URL> after you install Postgres locally.
Connect via a Desktop SQL Client
To connect to your Heroku Postgres database from a desktop SQL client, retrieve your Postgres connection string with heroku data:pg:credentials:url for Advanced (Limited GA) databases or heroku pg:credentials:url for non-Advanced databases:
$ heroku pg:credentials:url DATABASE -a example-app
Connection information for default credential.
Connection info string:
"dbname=dd5kj471cqesg9 host=ec2-34-254-86-177.eu-west-1.compute.amazonaws.com port=5432 user=u46uqkoa6qj67m password=p3f8e7… sslmode=require"
Connection URL:
postgres://u46uqkoa6qj67m:p3f9e86a3b7…@ec2-34-254-86-177.eu-west-1.compute.amazonaws.com:5432/dd5kj471cqesg9
The connection information contains:
- The complete connection URL of the database, in the format
postgres://user:password@hostname:port/database_name. - The database credentials including user and password.
- The SSL connection mode:
sslmode=require.
Connect from Apps and Services Outside of Heroku
Heroku Postgres databases are accessible from many programming languages and frameworks. See Connecting to Heroku Postgres for examples on creating connections with Heroku Postgres databases.
Connect from Salesforce Products
There are several ways to integrate Heroku and the Salesforce platform. Selecting the right integration method depends on your use case, the source you’re integrating with, the volume of data, the frequency of the integration, and so on. To learn about all the options to integrate Heroku with Salesforce, see the Integration Heroku and the Salesforce Platform Overview article. The following are some examples of integrating Heroku Postgres with Salesforce.
Heroku Connect
Heroku Connect is an add-on that synchronizes data between your Salesforce org and a Heroku Postgres database. Through a declarative interface, you select and create mappings for the Salesforce objects you want to sync with Postgres tables. Heroku Connect supports one-way sync and read data from Salesforce to Heroku Postgres and bidirectional sync and write data back to Salesforce from Heroku Postgres.
See Quick Start: Heroku Connect to get started with Heroku Connect.
Heroku External Objects and Salesforce Connect
Heroku External Objects provides an OData wrapper for a Heroku Postgres database configured to use Heroku Connect. Heroku External Objects makes it possible for other web services to retrieve data from the Heroku Postgres database using RESTful endpoints generated by the wrapper. When used with Salesforce Connect, you can view, edit, and search your Heroku Postgres data right from your Salesforce org.
See Heroku External Objects with Salesforce Connect to get started with Heroku External Objects.
MuleSoft
MuleSoft is an integration Platform as a Service (iPaaS) for creating complex, multi-system integrations, and managing the full lifecycle of APIs. MuleSoft abstracts away the complexity of backend systems and processes and provides scalable and governable APIs, which you can invoke from a Heroku app. Using the Database Connector, you can connect to any JDBC-compliant database like Heroku Postgres.
See Connecting Heroku Data Services to MuleSoft to get started with MuleSoft connectors and Heroku Postgres.
CRM Analytics
CRM Analytics is a customer and business analytics platform that works with any data source. Use connectors to connect data inside and outside of Salesforce, including your Heroku Postgres data.
See Heroku Postgres Connection to connect your Heroku Postgres database to CRM Analytics.
Considerations
To use Heroku Postgres databases outside of a Heroku app effectively, keep in mind these considerations.
Don’t Copy and Paste Credentials to a Separate Environment or App Code
Heroku manages the database URL, which sometimes changes, including:
- User-initiated database credential rotations using
heroku pg:credentials:rotate. - Catastrophic hardware failures that require Heroku Postgres staff to recover your database on new hardware.
- Security issues or threats that require Heroku Postgres staff to rotate database credentials.
Always fetch the database URL config var from the corresponding Heroku app when your app starts. For example, follow the 12-Factor application configuration principles by using the Heroku CLI to invoke your process. For example:
DATABASE_URL=$(heroku config:get DATABASE_URL -a your-app) your_process
This process ensures your process or app always has the correct database credentials.
Attach the Database as an Add-on to Other Heroku Apps
If you’re connecting to a database from other Heroku apps, you can attach a database add-on directly to multiple apps. Attaching a database to multiple apps makes sure that any changes to the database’s URL automatically propagate to all attached apps.
Enable SSL
Apps must support and use SSL to connect to a Heroku Postgres database. Most clients connect over SSL by default, but sometimes you must add the sslmode=require query parameter to your database URL before connecting.
Append the sslmode=require parameter to your database’s URL from the code, rather than editing the value of your DATABASE_URL config var directly. Heroku updates your database’s config var automatically and it overwrites any edits you make to it.
Use Heroku Postgres Backups
Heroku PGBackups isn’t supported on Heroku Postgres Advanced. Subscribe to our changelog to stay informed of when this feature is available for Advanced databases.
To get automated backups for your Heroku Postgres database, use Heroku PGBackups. You can create a manual backup on your database with the heroku pg:backups:capture command or schedule automatic backups that run daily.
By default, Heroku PGBackups takes backups of the database attached as DATABASE_URL in your Heroku app. Alternatively, you can provide the name of the database add-on you want to back up.