Connection String Generator for Your First App

Generate database connection strings for any programming language

Select Database

🐬
MySQL
🐘
PostgreSQL
🪟
SQL Server
🍃
MongoDB
🔴
Oracle
📄
SQLite
🔺
Redis
🦭
MariaDB

Connection Details

Generated Connection String

Connection String

Configure your connection details

Code Examples

Select a database and enter details

⚠️ Security Best Practices

  • Never commit connection strings to version control
  • Use environment variables for sensitive data
  • Enable SSL/TLS for production databases
  • Use strong, unique passwords
  • Restrict database user permissions

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.

How to use the generator

  1. Choose your database from the buttons at the top.
  2. Fill in the connection details. For SQLite you only need a file path. For server databases you need a host, port, database name, user name and password.
  3. Pick options such as SSL/TLS if your database requires an encrypted connection, which hosted databases usually do.
  4. Choose a format, then copy the string. The code examples show how to use it in Python, Node.js, Java, C#, PHP and Go.

The parts of a connection string

Here is a typical URL-style string, with a placeholder password:

postgresql://student:YOUR_PASSWORD@localhost:5432/school
PartExampleWhat it means
Schemepostgresql://Which kind of database to talk to
UserstudentThe account name to log in with
PasswordYOUR_PASSWORDThat account's password
HostlocalhostWhich computer the database runs on; localhost means your own machine
Port5432Which "door" on that computer the database listens at
DatabaseschoolWhich database on that server to use

Other formats, such as key-value strings for SQL Server, contain the same information written differently.

Keep the password out of your code

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.

Common beginner mistakes

What this tool cannot do

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.

Practise safely

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.