Database URL Parser
See what every part of a database connection string means
Connects to PostgreSQL database shop on db.example.com:5432 as app_user, encrypted with TLS.
Connection
Tells the client which database to talk to: PostgreSQL.
The database user to log in as. Its permissions decide what this connection can do.
The password for that user, shown decoded.
The server's address: a host name or IP address.
The network port the server listens on.
The database to open on the server.
Options
How strictly to use TLS encryption. require: Always use TLS, but don't check the server's certificate.
How long to wait for the connection to open, in seconds.
A label for this client, shown in the server's list of connections.
Database URL Parser guide
Most apps get their database from a single connection URL, usually in a DATABASE_URL environment variable. That one line packs in the database type, the login, the server, the database name, and a string of driver options. The Database URL Parser splits it into labelled rows and explains each one, so you can check where an app is pointed before it connects.
Example
A typical PostgreSQL URL. The next section takes it apart.
postgresql://app_user:s3cret@db.example.com:5432/shop?sslmode=requireWhat each part means
- Scheme. postgresql:// names the database engine, which tells the client which protocol to speak. A jdbc: prefix marks a Java URL, and a +driver suffix, as in postgresql+psycopg2, names the library SQLAlchemy should use.
- Username and password. app_user and s3cret, the login. The password is hidden on screen until you click Show.
- Host and port. db.example.com is the server, and 5432 is the port it listens on. When the URL leaves the port out, the parser shows the engine's default, such as 3306 for MySQL or 6379 for Redis.
- Database. shop, the database to open. For Redis it is a number from 0 to 15, and for SQLite the whole URL is a file path.
- Options. Everything after the ?. sslmode=require turns on TLS encryption. The parser explains the common options for each driver, such as connect_timeout, authSource, replicaSet, and charset.
Special characters in passwords
Inside a URL, @ separates the login from the host, / starts the database name, and # starts a fragment. A password that contains one of these raw breaks the URL for most drivers, often with a confusing error about an unknown host. Percent-encode them: @ becomes %40, / becomes %2F, and # becomes %23. The parser reads the password up to the last @ and warns you when it finds a raw character.
When it helps
- Checking that a deploy points at the right database and host before you run a migration.
- Debugging a connection that fails, by confirming the port, database name, and TLS settings.
- Reading a MongoDB Atlas or other hosted database string to see which options it sets.
- Turning a JDBC or SQLAlchemy URL into the plain host, port, and database a GUI client asks for.