Get Started Free

More information about SQL connection strings

Connecting to a SQL database requires a well-formed connection string. The exact shape depends on the engine and the driver, a JDBC URL for Java, a native URI for many languages, or an ADO.NET string for .NET. This guide explains the structure, components, and common options, using PostgreSQL as the primary example.

What is a connection string?

A connection string is a single string that tells a database driver how to connect: the server's location, the database name, credentials, and connection options. Java applications typically use a JDBC URL; other ecosystems use a URI or an ADO.NET-style string. This tool generates all of the relevant forms for each engine.

Components of a JDBC URL

General format

jdbc:postgresql://[host]:[port]/[database]?key1=value1&key2=value2

Example

jdbc:postgresql://localhost:5432/mydb?user=myuser&password=mypassword&ssl=true

This connects to the mydb database on localhost as myuser over an SSL connection.

Default ports and schemes by engine

Common connection parameters

Authentication

Security

Performance

Application identification

Tips for building a SQL connection string

Frequently asked questions

What is the difference between a JDBC URL and a URI?

A JDBC URL is prefixed with jdbc: and is consumed by Java's JDBC drivers. A native URI (e.g. postgresql://…) is what many non-Java languages and libraries expect. They carry the same information in slightly different syntax, this tool generates both.

Can I connect to multiple databases with one string?

No, a connection string targets a single database. To use several databases you create separate connection strings and connections.

What are the default ports?

PostgreSQL 5432, MySQL/MariaDB 3306, SQL Server 1433, Oracle 1521. SQLite is file-based and has no port. If your server uses a custom port, set it explicitly.

How do I debug connection issues?

Confirm the host, port, and credentials, check that firewalls/security groups allow access, and enable verbose logging in your driver or database server to see the underlying error.

VisuaLeaf

Work with any SQL database in VisuaLeaf

VisuaLeaf connects to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite and more, with a visual query builder, schema diagrams, charts, and a query profiler. The same modern client also speaks MongoDB.

MongoDB & SQL in one client
Visual query & aggregation builders
Live visual schema diagrams
Charts, dashboards & query profiler
Connection manager for local, cloud & teams
Free Community Edition