Generate database connection strings for any programming language
Configure your connection details
Select a database and enter details
A connection string is one line of text that tells your app where the database is and how to log in. The generator above builds one for you in your browser; nothing is sent to our server. Below, we explain each part in plain words, so you understand what you are copying.
Here is a typical URL-style string, with a placeholder password:
postgresql://student:YOUR_PASSWORD@localhost:5432/school
| Part | Example | What it means |
|---|---|---|
| Scheme | postgresql:// | Which kind of database to talk to |
| User | student | The account name to log in with |
| Password | YOUR_PASSWORD | That account's password |
| Host | localhost | Which computer the database runs on; localhost means your own machine |
| Port | 5432 | Which "door" on that computer the database listens at |
| Database | school | Which database on that server to use |
Other formats, such as key-value strings for SQL Server, contain the same information written differently.
The single most important habit: do not paste the real password into your source code. If the code is shared or uploaded to a public repository, anyone can read it. Instead, put the whole string in an environment variable, a setting your computer or hosting platform passes to your program, and read it from there. Our how-to on keeping a connection string in an environment variable shows exactly how.
@, : or /, which confuse URL-style strings unless they are encoded.It does not test the connection, and it cannot know your real host or password. If a generated string does not work, our page on diagnosing your first can't connect error walks through the usual causes.
Use a practice database and a practice password while learning. Avoid typing a real production password into any website, including this one, even though the generator runs only in your browser.
A free learning page for beginners. Practise on a test database, never on real customer data, and check the official documentation for your database version.