RubanTools

Database Connection String Generator

Generate connection strings for MySQL, PostgreSQL, MongoDB, MSSQL, Redis and SQLite - fill the form and copy the DSN.

Connection Details
Generated Connection Strings

Connection Strings FAQ

A connection string (DSN - Data Source Name) is a standardized string that contains all the information needed to connect to a database: host, port, database name, username, and password. Different database drivers expect different formats - URI-style (mysql://user:pass@host/db) or semicolon-separated key-value pairs (ADO.NET style).

Never hardcode connection strings in source code. Use environment variables (via .env files with dotenv) or secrets managers (AWS Secrets Manager, HashiCorp Vault). Connection strings contain credentials - exposing them in version control is a critical security risk. Add .env to .gitignore.

URI-style connection strings require percent-encoding for special characters in the password. For example, @ must be %40, / must be %2F. This tool uses encodeURIComponent() automatically. For non-URI formats (PDO DSN, ADO.NET), special characters are generally fine.