Database

Connection String Builder

Build and parse PostgreSQL, MySQL, Redis, MongoDB and SQL Server URIs, with the password percent-encoded so an awkward character cannot silently re-point the URI.

Connection

Everything is assembled in your browser and nothing is sent anywhere. Even so, the safest URI is one with no password in it — use the redacted copy below for anything you share.

Parameters

What each sslmode guarantees

disable
Plaintext. No encryption at all.
allow
Plaintext first, TLS only if the server refuses otherwise.
prefer
TLS if available, silently plaintext if not. This is libpq's default and it protects against nothing, because an attacker who can intercept can also strip it.
require
TLS required, but the certificate is not verified — so it stops passive sniffing and not an active man in the middle.
verify-ca
TLS required and the certificate chain verified, but not the hostname.
verify-full
TLS required, chain verified and hostname checked. The only mode that actually authenticates the server.
Parse an existing URI

Decodes the components so you can see what the client will actually use. Splitting on the last @ means a password with an unencoded one is still read correctly.

Connection URI
postgresql://[email protected]:5432/appdb?sslmode=verify-full

Safe to paste into a ticket or a chat. Identical to the real URI apart from the password, so it still parses.

  • InfoNo password in the URI, which is the right default — the client will look for one in its own configuration, prompt, or use a trust or IAM method.
  • Info5432 is PostgreSQL's default port, so it can be left out.
Other formats

Every form below has the password redacted. None of these are URIs, and a URI pasted into one is rejected — usually with an error that does not say why.

libpq keyword/value

host=db.internal port=5432 dbname=appdb user=appuser sslmode=verify-full

Accepted anywhere a URI is, including psql. Values are not percent-encoded, so an awkward password needs single quotes rather than escaping.

JDBC

jdbc:postgresql://db.internal:5432/appdb?sslmode=verify-full

JDBC takes the credentials as separate properties rather than in the URL.

psql

psql "postgresql://[email protected]:5432/appdb?sslmode=verify-full"

Quote the URI so the shell does not interpret ? and &.

Presets
No preset carries a password