Connection strings, built and decoded in your browser

Build or decode connection strings for 10 engines in every driver format, with warnings about TLS, passwords and typos. Nothing leaves your browser.

By

Here is a connection string that looks fine and isn't:

postgres://app:p@[email protected]:5432/sales?sslmode=require&ApplicationName=web

The password is p@ssword. A bare @ isn't allowed in the user part of a URL, so a parser that splits at the first one reads the password as p and the host as [email protected]. Drivers don't all split in the same place, which is why a string like this can work in one tool and fail in the next. sslmode=require encrypts without checking who answered. And ApplicationName isn't a libpq parameter at all; libpq spells it application_name and rejects the string with "invalid connection option".

Strings like this are why we built the free connection string builder & decoder. You fill in a form and get the connection string in every format your drivers use, or you paste one and it tells you what every key does and what is wrong with it.

Ten engines, the formats that really exist for each

The builder covers SQL Server and Azure SQL, PostgreSQL, MySQL, MariaDB, SQLite, Oracle, Redis and Valkey, ClickHouse, DuckDB, and libSQL / Turso. Each engine gets the formats people actually paste somewhere, not a generic template stretched to fit. For PostgreSQL that is the URI, a libpq keyword/value string, Npgsql's ADO.NET string, a pgJDBC URL, psqlODBC, a SQLAlchemy URL, a psql command and a node-postgres config object. For SQL Server it is ADO.NET, ODBC Driver 18, the Microsoft JDBC driver, go-mssqldb's URL, SQLAlchemy with pyodbc, and ready-to-paste pyodbc and mssql code. Oracle gets Easy Connect, a TNS connect descriptor, JDBC thin and ODP.NET. Redis gets a URI, a redis-cli command and a StackExchange.Redis configuration string.

Every engine also has its own page, such as /tools/connection-string-builder/sql-server or /postgresql, which opens the builder on that engine and adds a keyword reference table per driver (synonyms, defaults, what each one does) and the connection errors people search for, with the cause and the fix.

Building: one password, seven escaping rules

Most connection-string bugs are escaping bugs. Each format has its own rule for a value that contains a delimiter, and they don't agree. Give the builder a PostgreSQL password of p@ss:w/rd;"x and this is what comes out:

URI       postgresql://app:p%40ss%3Aw%2Frd%3B%[email protected]/sales?sslmode=verify-full
libpq     host=db.example.com dbname=sales user=app password=p@ss:w/rd;"x sslmode=verify-full
Npgsql    Host=db.example.com;Database=sales;Username=app;Password='p@ss:w/rd;"x';SSL Mode=VerifyFull
ODBC      Driver={PostgreSQL Unicode};Server=db.example.com;Database=sales;Uid=app;Pwd={p@ss:w/rd;"x};SSLmode=verify-full;

The URL forms (the URI, pgJDBC, SQLAlchemy) percent-encode the password. libpq needs nothing here, because it only cares about spaces, single quotes and backslashes. The ADO.NET string wraps the value in quotes because it contains a ;, and since the value already holds a double quote, it uses single quotes, the same choice .NET's own DbConnectionStringBuilder makes. ODBC puts it in braces.

Some cases can't be escaped at all, and the builder says so instead of guessing. A SQL Server password containing } is fine in the Microsoft JDBC driver, which doubles it, but Microsoft's ODBC documentation defines no escape for it, so the ODBC output carries a note to pass the password through the driver API. StackExchange.Redis separates options with commas, so a password with a comma has to be set in code. The psql command leaves the password out on purpose and tells you psql will prompt, or read PGPASSWORD or ~/.pgpass.

Other notes cover driver behavior that surprises people. go-mssqldb defaults to encrypt=false, which encrypts only the login packet, unlike Microsoft's own drivers. ODBC Driver 18 encrypts and validates the certificate by default where Driver 17 did not. And if you hand node-postgres a URI, it currently treats sslmode=require as verify-full unless you add uselibpqcompat=true.

Decoding: read it the way the driver would

The Decode tab takes whatever you paste (ADO.NET, ODBC, JDBC, URLs, libpq, Go DSNs, Oracle descriptors), works out the engine and format, and shows a table of every key with what it means. Keys the driver doesn't know get an "unknown" tag. Then come the warnings. Paste the SQL Server sample from the page:

Server=tcp:sql01.example.com:1433;Initial Catalog=Sales;User ID=sa;Password=Pa55word;TrustServerCertificate=True

and you get, among others:

  • host:port where SQL Server wants a comma. ADO.NET and ODBC read sql01.example.com:1433 as one host name, and the connection fails. It should be sql01.example.com,1433.
  • TrustServerCertificate=true turns off certificate validation: the traffic is encrypted, but anyone who can intercept it can pretend to be the server.
  • No Encrypt keyword, and what that means per driver: Microsoft.Data.SqlClient 4.0 and later encrypt and validate by default, so a self-signed server certificate fails with "The certificate chain was issued by an authority that is not trusted", while System.Data.SqlClient and SqlClient 3.x don't encrypt at all.
  • A plain-text password in the string, and an application signing in as sa.

Other engines have their own checks. A MySQL JDBC URL with useSSL=false is told that the setting is deprecated in favor of sslMode and that TLS is off, and allowPublicKeyRetrieval=true on an unencrypted connection is flagged because an attacker in the middle can swap the RSA key and capture the password. A Redis URL like redis://[email protected] is ambiguous, since most clients read secret as the password and some as a user name; the decoder suggests redis://:secret@host, and points out that redis:// sends the AUTH password in plain text. An Oracle JDBC URL ending in :FREEPDB1 connects by SID, and the decoder warns that if FREEPDB1 is really a service name, which pluggable and most cloud databases are, you'll get ORA-12505 and need /FREEPDB1 instead.

Under the warnings, the decoder rebuilds the same connection in every other format for that engine, already correctly escaped, and "Edit in the builder" loads it into the form. That's the quickest way to turn a JDBC URL from a Java service into the ADO.NET string a .NET service needs. Options the tool doesn't model are kept only in the format they came from, and the page lists them so you can carry them across by hand.

The same parser as the app

SQLly's connection editor has a box where you paste a connection string. That code lives in the desktop app's Rust core, in connection_url.rs. The tool ships a line-for-line JavaScript port of it, and a node:test suite replays the Rust test table against the port, so if either side changes behavior, a case fails.

The decoder runs your string through that port too and says how the app will read it. For the PostgreSQL string at the top of this post, it reports that SQLly's reader sees a connection to [email protected]. That isn't a bug in the decoder. It's the honest answer, and it's the strongest argument for percent-encoding the @.

The same check guards the "Open in SQLly" button. It builds a sqlly://connection/new link that opens the app's connection editor with the host, port, database and user filled in. Before offering it, the page parses its own link with the ported reader and compares the result field by field with what you typed. If the app would read anything differently, you get the reason instead of a link. The password goes into the link only if you tick the box, and the app doesn't write it to its connection file. Some cases aren't supported yet and are named: Oracle strings, and SQL Server's Microsoft Entra Authentication= keyword, which you choose in the app's editor instead. (We wrote about the launch-link side of SQLly in Open in SQLly.)

Nothing leaves the tab

People paste production passwords into tools like this, so the design is simple: the builder and decoder are plain JavaScript files with no network calls. They make no request with what you type, they don't store anything (not even in your browser's storage), and the page keeps working offline once it's loaded. Passwords are masked in the output until you tick "Show password". The "Open in SQLly" link goes from your browser straight to the app on your machine.

Try it

Paste the string you're fighting with into the connection string builder & decoder, or start from your engine's page for the keyword reference. If you'd rather not deal with connection strings at all, SQLly is a native SQL client for macOS, Windows and Linux that keeps passwords in your system keychain. There are more free tools at /tools.