Direct connections

Learn about connecting directly to your Prisma Postgres database via direct TCP

Overview

Prisma Postgres is the perfect choice for your applications, whether you connect to it via Prisma ORM or any other ORM, database library / tool of your choice. If you use it with Prisma ORM, Prisma Postgres comes with built-in connection pooling.

If you connect to it via another tool, you can do so with a direct connection string following the conventional PostgreSQL format.

How to connect to Prisma Postgres via direct TCP

In order to get a direct connection string, you need to:

  1. Open a project in your Prisma Console account (or create a new one)
  2. Navigate to your active Prisma Postgres instance.
  3. Click the Connect to your database button in your dashboard.
  4. Click the Generate new connection string button.
  5. If enabling connection pooling, click the toggle button
  6. Copy the connection string that is generated below.

Animated walkthrough of generating a connection string in Prisma Console: navigating to the database, clicking Connect, generating a new connection string, toggling connection pooling, and copying the result.

Connection string

Format

When you connect to Prisma Postgres via direct TCP, your connection string looks as follows:

DATABASE_URL="postgres://USER:PASSWORD@db.prisma.io:5432/?sslmode=require"

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:sk_QZ3u8fMPFfBzOID4ol-mV@db.prisma.io:5432/?sslmode=require"

SSL mode

SSL mode is required when connecting to Prisma Postgres via direct TCP, so you need to append sslmode=require to your TCP connection string.

Billing

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.

Temporary limitations

Closing idle connections

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.)

Connection limit

FreeStarterProBusiness
Connection limitMax 10Max 10Max 50Max 100

Query and transaction timeouts

FreeStarterProBusiness
Query timeoutUp to 10 secondsUp to 10 secondsUp to 10 secondsUp to 10 seconds
Interactive transactions timeoutUp to 15 secondsUp to 15 secondsUp to 15 secondsUp to 15 seconds

Limited user permissions

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.

TCP tunnel (deprecated)

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:

For step-by-step examples of connecting with database editors, see Viewing data in Prisma Postgres.

On this page