Connection strings, direct and pooled connections
Find your host, port and credentials, choose between the pooled, regular and direct connection, and test that they work.
Open Databases > Connection to connect an app or a tool to your database. All connections require TLS.
Discrete parameters
The first card shows the standard PostgreSQL parameters, which you can paste into any driver, ORM or client:
- Host Endpoint
- TLS Public Port
- Database Name
- Username / Role
- Password
- SSL Mode:
require
Use Hide Credentials to cover the password while sharing your screen. If the password is not stored, strings show [YOUR_PASSWORD]. Choose Rotate Role Key to set a new one (auto-generated, or a custom value you type), then update every app that uses it. Reset Sessions disconnects your database role's open sessions, which can clear stuck locks and idle transactions; your apps reconnect.
Which connection string should I use?
Depending on how your database is set up, the page offers up to three strings. Copy the exact host and port from the page; the numbers below are only typical.
| Connection | Label on the page | Use it for |
|---|---|---|
| Pooled | DATABASE_URL |
Everyday app traffic: web apps, APIs, serverless and edge functions. Many app connections share a few database connections, one transaction at a time. |
| Regular (session) | DIRECT_URL |
Migrations, schema tools, pg_dump, LISTEN/NOTIFY, advisory locks and anything that uses SET. Each client keeps its own connection until it disconnects. |
| Direct | Direct Connection String | Straight to the database server with no pooler. Same uses as the regular connection. |
Some databases are reached only through the pooled connection. The page tells you, and says which features do not carry between transactions.
What the pooled connection does not keep
Because connections are shared, things that live for the whole session do not last between transactions: plain SET, LISTEN/NOTIFY and advisory locks. Use SET LOCAL inside a transaction instead, or switch to the regular or direct connection for those jobs. Prepared statements work on the pooled connection, so most drivers and ORMs need no change. With Prisma on a pooled-only database, add the extra URL parameter the page tells you to.
Connections are limited
Each database has a limit on connections. On the regular and direct connections, close tools when you are done. If you hit the limit, use the pooled string for app traffic.
Copy a ready-made snippet
App Framework Quick-Start has tabs for .env, Node / TS, Prisma, Drizzle, Python and psql CLI, with Copy Code. Paste, replace [YOUR_PASSWORD] if needed and run.
Test the connection
Connection Check signs in through each connection string from the Console's side and says whether it works. Choose Test again after you change anything, such as a role key or an IP rule. If a string fails here but works for you, check your own network and see Network access.
Good to know
- Your database also has its own address that you can rename. See Your database's own address.
- The default ports are commonly 5433 for direct TLS connections and 6432 for the pooled connection. Trust the Connection page for your database.
- After rotating the role key, running apps keep failing until you update their connection string.
- Never paste a connection string with a password into a public place. Treat it like a secret.
More guides in Console: databases
Create a database
Add a PostgreSQL database to a project, choose its version and extensions, and manage several databases in one project.
Your database's own address
Use the per-database address shown on the Connection page, what is faster about it, and how to rename it safely.
The SQL editor
Run queries and scripts against your database from the Console, use templates and history, and understand the safety limits.
Import data into a database
Bring a database over from another host, or upload a .sql or .sql.gz dump, from the Backups page.
Extensions
See which PostgreSQL extensions are available for your database, enable or disable them and understand "needs approval".
PostgreSQL versions and upgrades
Choose a version when you create a database and upgrade to a newer one from DB Settings, with a verified copy.