Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Neon · Const

Connection string direct

A direct Neon connection string connects straight to Postgres without the pooler. In the Connect modal, disable Connection pooling to obtain it; use it for migrations, pg_dump, and LISTEN/NOTIFY.

How it works

A direct connection string targets Neon’s Postgres endpoint without the connection pooler. Obtain it from the Connect modal by disabling Connection pooling; the resulting URL contains the role, password, hostname, and database name.

Syntax

postgresql://user:password@host/database?sslmode=require&channel_binding=require

Returns

A PostgreSQL connection URL for the selected Neon branch, compute, database, and role.

Key points

  • In the Connect modal, disable the pooling option to switch from the default pooled URL to a direct URL.
  • The URL carries the credentials and database endpoint information needed to connect to the selected Neon database.
  • A direct hostname is identified by the absence of -pooler; a hostname containing that suffix routes through pooling.
  • Direct connections suit schema migrations, database dumps, and notification features that depend on direct session behavior.
  • For application traffic with many simultaneous clients, the pooled variant is generally the appropriate connection choice.

Common mistakes

  • The Console initially displays a pooled URL, so turn off Connection pooling before copying a direct string.
  • Do not substitute the pooled URL for operations that require direct, session-oriented database access.

Example: Use a direct Neon connection string

const connectionString = process.env.DATABASE_URL_UNPOOLED;
if (!connectionString) throw new Error("DATABASE_URL_UNPOOLED is required");
console.log(connectionString);

Reads a direct Neon connection string from an environment variable for use by migrations or other session-dependent tooling.

When to use it

Run migrations directly against Postgres

Schema changes

Use pg_dump and other administrative tools

Database administration

Use LISTEN/NOTIFY and similar session-aware operations

Session-dependent features

Interview questions

QHow do you distinguish a direct Neon connection string from a pooled one?

A direct connection goes straight to Postgres rather than through Neon’s pooler. Its hostname does not contain the -pooler suffix.

Follow-up: When should an application prefer the pooled endpoint? Use it when the application opens many concurrent connections, such as serverless workloads.

QHow do you obtain a direct connection string in Neon?

Open the project in the Neon Console, click Connect, select the branch, compute, database, and role, then disable Connection pooling and copy the URL.

Follow-up: What does the connection string identify? It includes the role, password, hostname, and database name.

QWhat are common uses for a direct connection?

Use a direct string for migrations, pg_dump, and LISTEN/NOTIFY, because these operations need direct or session-aware database behavior.

Follow-up: Why not use the pooled URL for every operation? Pooling changes connection handling and is intended primarily for high-concurrency application traffic.

  • Connection pooling
  • pooled connection string
  • Connect to your branch
  • pg_dump
  • LISTEN/NOTIFY

Source: Where can I find my database connection string in Neon? - Neon FAQs. Checked 2026-10-16.