Codepackr / formatters / Database Connection String Builder

Database Connection String Builder

Construct, format, and parse database connection URIs for PostgreSQL, MySQL, MongoDB Atlas, and Redis with client-side privacy.

Client-Side Execution & Privacy Guarantee

This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.

A connection string is the single piece of text that tells a client library how to reach a database: host, port, credentials, database name, and optional parameters such as SSL mode or timeout. Different engines use different formats—URI style for PostgreSQL and MongoDB, semicolon-delimited key-value pairs for SQL Server, and so on.

This tool lets you fill structured fields and receive a correctly formatted string, or paste an existing string and see each component extracted. All processing happens locally in the browser; nothing is transmitted.

URI versus key-value formats

PostgreSQL, MySQL, and MongoDB commonly accept a URI of the form protocol://user:password@host:port/database?param=value. Special characters in the password must be percent-encoded. Redis uses a similar URI but also supports a simpler host:port style.

SQL Server historically uses a semicolon-separated list: Server=host,port;Database=name;User Id=user;Password=pass;. Azure and other cloud providers add extra keys such as Encrypt=true or TrustServerCertificate=false. The tool knows the conventional keys for each engine.

Security and encoding rules

Passwords and usernames that contain reserved characters (@, :, /, ?, #, %) must be percent-encoded in URI formats. The builder performs this encoding automatically. When parsing, it decodes them so you see the original values.

Never store a connection string that contains a real password in source control. The tool can generate a placeholder version with the password masked or omitted so you can safely share the rest of the configuration.

Common optional parameters

SSL/TLS mode, connection timeout, application name, and pool size appear under different names depending on the driver. The form exposes the most frequently used options for each engine and places unrecognized parameters in a free-form extra field so nothing is lost.

When you parse an existing string, unknown parameters are preserved and shown in the extras section. You can edit them and regenerate the string without having to remember the exact key names.

When to use this tool

  • Setting up a new local or staging database
  • Debugging a connection failure by inspecting each component
  • Generating a string for a cloud-hosted instance
  • Converting between URI and key-value styles
  • Preparing configuration for CI or container environments

How to use the Database Connection String Builder

  1. Select the database engine from the dropdown.
  2. Enter host, port, database name, username and password in the corresponding fields.
  3. Add any optional parameters (SSL mode, timeout, etc.).
  4. Click Build to produce the connection string.
  5. To reverse the process, paste a string into the Parse tab and click Parse.
  6. Copy the result or the individual fields as needed.
  7. Toggle “mask password” if you intend to share the string.

Worked examples

PostgreSQL URI

Input
host=localhost port=5432 db=app user=dev password=s3cret
Output
postgresql://dev:s3cret@localhost:5432/app

Password left unencoded because it contains no reserved characters.

SQL Server key-value

Input
Server=sql.example.com,1433;Database=orders;User Id=appuser;Password=p@ss;Encrypt=true
Output
Server=sql.example.com,1433;Database=orders;User Id=appuser;Password=p%40ss;Encrypt=true

The @ in the password is percent-encoded when the tool rewrites the string.

Common mistakes and tips

  • Always percent-encode passwords that contain @, :, / or %.
  • Prefer the URI form for PostgreSQL and MongoDB; it is more portable.
  • Include sslmode=require (or Encrypt=true) for any non-local connection.
  • Test the generated string with the actual client library before committing it.
  • Keep a masked version in documentation and the real version only in a secrets manager.

Frequently asked questions

Does the tool support every possible parameter?

It knows the common parameters for each engine and preserves any additional key-value pairs you supply. Driver-specific extensions that are not widely used may need to be added manually in the extras field.

How are passwords with special characters handled?

In URI formats the tool percent-encodes them automatically. In key-value formats it leaves them as-is unless the particular engine requires escaping, which is rare.

Can I parse a string that uses a non-standard port?

Yes. The port is extracted whatever value it has. If the port is omitted, the tool shows the engine’s default port as a hint.

Is the generated string ready for production?

It is syntactically correct, but you still need to verify network reachability, firewall rules, and that the credentials have the expected privileges.

What happens if I paste a malformed string?

The parser highlights the portion it cannot understand and leaves the successfully extracted fields filled so you can correct only the broken part.