← Free tools

Connection string builder

Paste a database connection string in any form, or fill in the parts, and get it in every other one: URI, JDBC, libpq, SQLAlchemy, .NET, ODBC, Go and the command line — for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, MongoDB and SQLite. Special characters in the password are encoded the way each form needs, and TLS is written the way each driver spells it.

No sign-up. Everything here runs in your browser; nothing is sent, the password included.

Database

TLS

More on PostgreSQL: PostgreSQL connection strings

URI

psql, libpq, psycopg, asyncpg, node-postgres, pgx, Prisma, DATABASE_URL · connected with on a real server

postgresql://app_user@localhost:5432/app

Keyword/value (libpq)

psql, psycopg, pgx, any libpq program · connected with on a real server

host=localhost port=5432 dbname=app user=app_user

JDBC

Java (pgJDBC), DBeaver, IntelliJ, Spring

jdbc:postgresql://localhost:5432/app?user=app_user

SQLAlchemy

Python with SQLAlchemy and psycopg 3

postgresql+psycopg://app_user@localhost:5432/app

.NET (Npgsql)

C#, EF Core

Host=localhost;Port=5432;Database=app;Username=app_user

psql command

Shell · connected with on a real server

psql postgresql://app_user@localhost:5432/app

Environment variables (libpq)

psql, pg_dump and every libpq program, with no string at all · connected with on a real server

export PGHOST=localhost
export PGPORT=5432
export PGDATABASE=app
export PGUSER=app_user

Special characters in a password

In a URL these must be percent-encoded. Key=value forms (libpq, ADO.NET, ODBC, JDBC for SQL Server) quote the value instead, and the Go MySQL DSN takes the password as it is. Per-database details: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, MongoDB, SQLite.

CharacterIn a URLWhy it breaks
@%40Ends the user name and password: everything after the first unencoded @ is read as the host.
:%3ASeparates user from password, and host from port.
/%2FStarts the database name.
?%3FStarts the options.
#%23Starts a fragment: the rest of the string is thrown away.
%%25Starts an escape itself, so a literal % must be escaped too.
&%26Separates options.
+%2BSome parsers (PyMongo among them) read + as a space.
space%20Ends the string on a command line, and is trimmed by some parsers.

Questions

Is my password sent anywhere?

No. The strings are parsed and built in your browser by code on this page; nothing you type is sent to a server or stored.

Which forms can I paste in?

URLs (postgresql://, mysql://, mariadb://, mongodb://, mongodb+srv://, SQLAlchemy URLs such as postgresql+psycopg://), JDBC URLs for all six server databases, libpq keyword/value strings, ADO.NET and ODBC key=value strings, Go MySQL DSNs, Oracle Easy Connect and connect descriptors, a DATABASE_URL line from a .env file, and SQLite paths.

Why does my password with an @ break the connection string?

In a URL the first @ ends the user name and password, so a raw @ in the password makes the driver read the rest as the host. Percent-encode it as %40 (and : as %3A, / as %2F, # as %23, % as %25). Key=value forms need quoting instead of encoding, and the Go MySQL DSN needs neither. The builder does the right one for each form.

Were these strings tested?

Each form the page can read is parsed back and compared with what built it, for every database and TLS setting, using a password made of every awkward character. The forms marked "connected with on a real server" were then used to log in to PostgreSQL 16, MySQL 8, MariaDB 11, SQL Server 2022, Oracle 23ai, MongoDB 7 and SQLite, through their own drivers and command-line clients.

What does the TLS setting change?

"TLS, verify the certificate" encrypts the connection and checks that the server is who it claims to be — what you want across any network you don't control. "Don't check the certificate" still encrypts but would not notice an impostor. Each driver spells this differently (sslmode, sslMode, Encrypt, tls), so the builder writes it for you.

Got the string working? Point it at something useful.

Paste it into DBShifts to browse the database with sensitive columns masked, or to migrate it to another engine with every table checked afterwards.

Other free tools