apps/docs/content/docs/postgres/database/direct-connections.mdx
Prisma Postgres supports both direct and pooled TCP connections, whether you connect to it via Prisma ORM or any other ORM, database library / tool of your choice. This page covers the direct, non-pooled connection string. For pooled TCP connections, see Connection pooling.
In order to get a direct connection string, you need to:
When you connect to Prisma Postgres via direct TCP, your connection string looks as follows:
DATABASE_URL="postgres://USER:PASSWORD@HOST:PORT/DATABASE_NAME?sslmode=require"
This is built up from the following parts:
The USER and PASSWORD values are provided when you generate credentials for your Prisma Postgres instance in the Prisma Console. Here is an example with sample values:
DATABASE_URL="postgres://2f9881cc7eef46f094ac913df34c1fb441502fe66cbe28cc48998d4e6b20336b:[email protected]:5432/?sslmode=require"
SSL mode is required when connecting to Prisma Postgres via direct TCP, so you need to append sslmode=require to your TCP connection string.
When using direct TCP to connect to a Prisma Postgres instance, every request is counted as a billable operation. Learn more on our pricing page.
Prisma Postgres closes idle connections after an extended period of time. If that happens in your application, you can re-open a new connection. (Most database clients re-connect automatically.)
| Free | Starter | Pro | Business | |
|---|---|---|---|---|
| Connection limit | Max 10 | Max 10 | Max 50 | Max 100 |
| Free | Starter | Pro | Business | |
|---|---|---|---|---|
| Query timeout | Up to 10 seconds | Up to 10 seconds | Up to 10 seconds | Up to 10 seconds |
| Interactive transactions timeout | Up to 15 seconds | Up to 15 seconds | Up to 15 seconds | Up to 15 seconds |
User permissions are limited to read, write and schema changes. It is not possible to create separate databases, manage users and roles, or perform other administrative actions.
:::warning
The TCP tunnel feature has been deprecated in favor of direct connections. Please use direct connections for all new integrations and migrate existing implementations.
:::
Use your direct TCP connection string with your preferred PostgreSQL client or tooling. Common options include:
psql, the PostgreSQL command-line client.For step-by-step examples of connecting with database editors, see Viewing data in Prisma Postgres.