October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Choose the Right PostgreSQL URL for Supabase, Neon, or Railway

Use the provider-generated PostgreSQL URI that matches your app's runtime and network. Learn when to choose direct or pooled connections and how Supabase, Neon, and Railway differ.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the PostgreSQL connection URI generated for your project and choose its direct, pooled, private, or public form according to where your app runs and how it opens connections. A URI has a familiar shape, but its host, username, port, database, and options are specific to the provider and resource. Do not build one from a generic example.

What a PostgreSQL connection string contains

A typical PostgreSQL URI looks like this:

postgresql://USER:PASSWORD@HOST:PORT/DATABASE?PARAMETER=VALUE

The scheme may be postgresql:// or postgres://. The username, password, hostname, port, and database identify the connection; query parameters can set options such as TLS. PostgreSQL documents both URI schemes at libpq connection strings. Driver support for URI options can vary, so consult your driver’s documentation if you split the URI into separate settings.

As an Amazon Associate I earn from qualifying purchases.

Use the exact value shown for the project, branch, role, database, and connection mode you intend to use. Replace any password placeholder, but not with its surrounding brackets. Reserved characters in a password must be percent-encoded so they are not interpreted as URI syntax.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose direct or pooled access based on the workload

Direct connections and poolers differ in reachability and connection behavior. A pooler can suit applications that create many short-lived connections, but some modes do not provide a dedicated database session. Before choosing, check where the client runs, whether the endpoint is reachable from there, and whether the driver or ORM needs session features such as prepared statements.

Supabase: select a connection mode

Supabase offers direct connections and shared pooler modes. Copy the method-specific URI from the project’s dashboard; do not infer a pooler hostname from the region alone. Its connection guidance is at Supabase’s PostgreSQL connection guide.

Mode Best fit Details to check
Direct Persistent backends such as VMs and long-running containers Uses port 5432. Direct connectivity is IPv6 unless the project has the IPv4 add-on.
Shared pooler, session mode Clients needing session-style connections, including clients that need an IPv4 alternative to direct access Uses port 5432, a generated pooler host, and a username that includes the project reference.
Shared pooler, transaction mode Serverless or edge functions that create many short-lived connections Uses port 6543. Prepared statements and query pipelining are not supported; disable prepared statements in clients that use them.
Dedicated pooler Paid-plan workloads using transaction pooling Available on paid plans in transaction mode; session mode uses the shared pooler.

For serverless code, Supabase advises creating the client once at module scope, keeping the application’s own connection pool small, disabling prepared statements when using transaction mode, and requiring SSL. The application-side pool is separate from Supabase’s pooler, so size it with the function’s concurrency and connection limits in mind.

Neon: use the endpoint and role for the intended branch

Neon URIs follow the standard PostgreSQL format and include the role, password, host, database, and commonly sslmode=require. For applications that open many concurrent connections, Neon recommends the pooled URI; its hostname includes the -pooler suffix. The connection guide is at Neon’s connection guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Neon’s connection URI API can generate a URI with a pooled endpoint and lets you select a branch, endpoint, database, and role. Use the actual endpoint and credentials for that selection rather than copying an illustrative host. See Neon’s connection URI API reference.

Railway: use private variables inside the project or enable public access

Railway’s PostgreSQL service exposes PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE, and DATABASE_URL for project services. The database is private by default. Services in the same project environment can connect over Railway’s private network, using the service’s private hostname and connection variables. Railway documents this setup at Railway’s PostgreSQL guide and private networking guide.

To connect from outside Railway, enable public access in service networking. Railway then creates a TCP proxy and exposes DATABASE_PUBLIC_URL; use that external URL rather than the private in-project address. Keep the public endpoint protected by credentials and appropriate network controls.

If PgBouncer is enabled, Railway distinguishes pooled values (DATABASE_URL and DATABASE_PUBLIC_URL) from unpooled values (DATABASE_UNPOOLED_URL and DATABASE_PUBLIC_UNPOOLED_URL). Use the unpooled URI for work requiring a dedicated session. See Railway’s connection-pooling documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Configure TLS deliberately

Do not assume that an SSL option means the server’s identity is verified. Supabase explains that sslmode=require encrypts the connection but does not verify the server identity. For certificate-based verification, its guide describes downloading the project’s root certificate and using sslmode=verify-full with sslrootcert. Check that the selected driver’s TLS settings support the parameters you use.

Keep credentials out of source code

Store the URI in an environment variable such as DATABASE_URL or use your platform’s managed variable references. Do not commit a literal database password in application code or a public repository. Railway reference variables can track service variables when they change; see Railway’s variables guide.

Check these issues when a connection fails

  • Wrong resource: confirm the URI belongs to the intended project, branch, role, database, and endpoint.
  • Incorrect password syntax: replace the placeholder and percent-encode reserved password characters.
  • Host or port mismatch: use the dashboard’s generated endpoint for the selected direct or pooled mode. For Supabase, do not derive the shared pooler host from the region name.
  • Unsupported connection behavior: with Supabase transaction pooling, disable prepared statements and account for the documented transaction-pooling limitations.
  • Railway address not reachable: use private variables from an in-project service; for an external client, enable public access and use DATABASE_PUBLIC_URL.
  • TLS mismatch: check both the provider’s settings and the client driver’s TLS configuration. In Supabase’s explanation, require encrypts without verifying server identity.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.