// free tool

SQL Server connection string builder

Build a SQL Server or Azure SQL connection string for ADO.NET (Microsoft.Data.SqlClient), ODBC Driver 18, JDBC, Go and SQLAlchemy from one form, or paste one to see what every keyword does and what is risky. It all runs in your browser: nothing you type is sent anywhere.

Open this connection in SQLly

Opens SQLly's connection editor filled in.

Private by design. The builder and decoder are plain JavaScript running in this tab. The page sends no request with what you type, stores nothing (not even in your browser), and keeps working offline once loaded. The Open in SQLly link goes from your browser straight to the app on your computer.

SQL Server connection string formats

SQL Server drivers share a keyword=value style but not the keywords: ADO.NET says User ID and Connect Timeout, ODBC says Uid and ConnectTimeout, JDBC says user and loginTimeout, and Go uses a URL. They also share one trap: a port goes after a comma (host,1433), not a colon, everywhere except JDBC and Go.

The other thing that trips people up is encryption. Microsoft.Data.SqlClient 4.0, ODBC Driver 18 and JDBC Driver 10.2 all encrypt by default and validate the server certificate, so strings that worked for years started failing after an upgrade. The builder states Encrypt explicitly, and the decoder tells you what an unset Encrypt means for each driver.

ADO.NET Microsoft.Data.SqlClient, System.Data.SqlClient, Entity Framework, Dapper

Server=sql01.example.com;Database=Sales;User ID=app_user;Password=your_password;Encrypt=True;

ODBC ODBC Driver 18 for SQL Server, pyodbc

Driver={ODBC Driver 18 for SQL Server};Server=sql01.example.com;Database=Sales;Uid=app_user;Pwd=your_password;Encrypt=yes;

JDBC Microsoft JDBC Driver for SQL Server

jdbc:sqlserver://sql01.example.com;databaseName=Sales;user=app_user;password=your_password;encrypt=true;

Go URL github.com/microsoft/go-mssqldb

sqlserver://app_user:[email protected]?database=Sales&encrypt=true

SQLAlchemy URL Python SQLAlchemy with pyodbc

mssql+pyodbc://app_user:[email protected]/Sales?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=yes

Windows authentication (ADO.NET) Integrated Security

Server=sql01.example.com;Database=Sales;Integrated Security=True;Encrypt=True;

Azure SQL with Microsoft Entra ID (ADO.NET) Managed identity, Azure CLI or Visual Studio sign-in

Server=myserver.database.windows.net;Database=Sales;Authentication=Active Directory Default;Encrypt=True;

Placeholders such as your_password are just that: build your own string with the form above. More about connecting SQLly to SQL Server: SQLly for SQL Server.

Microsoft.Data.SqlClient (ADO.NET) keywords

Keywords are case-insensitive, spaces around them are ignored, and when a keyword (or one of its synonyms) appears twice the last value wins. An unknown keyword throws Keyword not supported. Quote a value in " or ' when it contains ;, or starts or ends with a space or quote; inside the quotes, double the quote character.

KeywordSynonymsDefaultWhat it does
Server Data Source, Address, Addr, Network Address - host, host\instance, host,port, or tcp:host,port. . and (local) mean this machine; (localdb)\MSSQLLocalDB is LocalDB. A named instance is found through SQL Server Browser on UDP 1434.
Database Initial Catalog the login's default database Database to use once connected.
User ID UID, User - SQL login, or the Entra user name for Active Directory Password / Interactive.
Password PWD - Ignored when Integrated Security is on.
Integrated Security Trusted_Connection false true, yes or sspi signs in as the Windows account running the process (Kerberos or NTLM).
Authentication - not set Sql Password, Active Directory Integrated, Active Directory Interactive, Active Directory Default, Active Directory Managed Identity (alias Active Directory MSI), Active Directory Service Principal, Active Directory Device Code Flow, Active Directory Workload Identity (5.2+), Active Directory Password (deprecated). From 7.0 the Entra methods need the Microsoft.Data.SqlClient.Extensions.Azure package.
Encrypt - true (Mandatory) in 4.0+; false in 3.x and earlier true/yes/Mandatory, false/no/Optional, or Strict (5.x+, TDS 8.0: SQL Server 2022+ and Azure SQL). With Optional the login packet is still encrypted, the rest is not.
TrustServerCertificate Trust Server Certificate false true skips certificate validation. Ignored (treated as false) with Encrypt=Strict.
HostNameInCertificate Host Name In Certificate - 5.0+. The name to expect in the server certificate when it differs from Server, for example when connecting through an alias or IP address.
ServerCertificate Server Certificate - 5.1+. Path to a certificate file the server's certificate must match exactly.
Connect Timeout Connection Timeout, Timeout 15 Seconds to wait for a connection before failing.
Command Timeout - 30 2.1+. Default SqlCommand.CommandTimeout in seconds; 0 waits forever.
Application Name App Core Microsoft SqlClient Data Provider (.NET) Shows up as program_name in sys.dm_exec_sessions and in Profiler / Extended Events.
ApplicationIntent Application Intent ReadWrite ReadOnly routes to a readable secondary of an availability group or a read replica in Azure SQL.
MultiSubnetFailover Multi Subnet Failover false Set to true when connecting to an availability group listener that spans subnets, for faster failover.
MultipleActiveResultSets Multiple Active Result Sets false MARS: several open readers on one connection.
Pooling - true Connection pooling.
Max Pool Size - 100 Largest number of pooled connections per distinct connection string.
Min Pool Size - 0 Connections kept open in the pool.
ConnectRetryCount Connect Retry Count 1 0 to 255 reconnect attempts after an idle connection breaks.
ConnectRetryInterval Connect Retry Interval 10 1 to 60 seconds between those attempts.
Persist Security Info PersistSecurityInfo false true leaves the password readable in ConnectionString after opening. Leave it off.

ODBC Driver 18 for SQL Server keywords

Used by pyodbc, R, PHP, Excel and anything else on ODBC. Wrap values that contain special characters ([]{}(),;?*=!@) in braces. Unlike ADO.NET, when a keyword repeats the first occurrence wins.

KeywordSynonymsDefaultWhat it does
Driver - - {ODBC Driver 18 for SQL Server} (or 17). Must match the name the driver manager lists.
Server Address, Addr - [tcp:]host[\instance][,port].
Database - login default Database name.
UID / PWD - - SQL login and password.
Trusted_Connection - no yes uses Windows authentication.
Authentication - - SqlPassword, ActiveDirectoryIntegrated, ActiveDirectoryInteractive (Windows), ActiveDirectoryMsi, ActiveDirectoryServicePrincipal, ActiveDirectoryPassword (deprecated). There is no ActiveDirectoryDefault in ODBC.
Encrypt - yes (Driver 18), no (17 and older) yes/mandatory, no/optional, strict (18.1.2.1+).
TrustServerCertificate - no yes skips certificate validation; ignored with Encrypt=strict.
HostnameInCertificate - - 18.0+. Expected certificate host name.
ServerCertificate - - 18.1+. Certificate file the server certificate must match.
ConnectTimeout - 15 18.7+. Login timeout in seconds; 0 means no limit. Older drivers only take SQL_ATTR_LOGIN_TIMEOUT from code.
APP - - Application name.
ApplicationIntent - ReadWrite ReadOnly for readable secondaries.
MultiSubnetFailover - No Yes for multi-subnet availability groups.

Microsoft JDBC Driver for SQL Server properties

URL form: jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value...]. Property names are case-insensitive. A value containing ; goes in braces, and from driver 8.4 a closing brace inside braces is doubled: password={pass;}}word}.

KeywordSynonymsDefaultWhat it does
databaseName database - Database name.
user userName - Login name.
password - - Password.
integratedSecurity - false Windows authentication. On Windows it needs mssql-jdbc_auth-<version>.dll; elsewhere add authenticationScheme=JavaKerberos.
authentication - NotSpecified SqlPassword, ActiveDirectoryPassword, ActiveDirectoryIntegrated, ActiveDirectoryInteractive (9.2+), ActiveDirectoryServicePrincipal (9.2+), ActiveDirectoryManagedIdentity (12.2+; ActiveDirectoryMSI before).
encrypt - true (10.2+); false (9.4 and older) true, false, or strict (11.2+).
trustServerCertificate - false true skips certificate validation.
hostNameInCertificate - - Expected certificate host name.
serverCertificate - - 11.2+. Certificate file to match, used with strict.
loginTimeout - 30 (11.2+), 15 (older) Seconds to wait for the login.
queryTimeout - -1 (no limit) Default query timeout in seconds.
applicationName - Microsoft JDBC Driver for SQL Server Application name.
applicationIntent - ReadWrite ReadOnly for readable secondaries.
multiSubnetFailover - false Multi-subnet availability groups.
instanceName - - Named instance, as an alternative to host\instance in the URL.

go-mssqldb URL parameters

URL form: sqlserver://user:password@host:port?database=... or sqlserver://user:password@host/instance?.... The path is the instance name, never the database. Percent-encode special characters in the user and password. Parameter names are case-insensitive.

KeywordSynonymsDefaultWhat it does
database - - Database name.
encrypt - false (login packet only) strict, disable (no TLS at all), false, true. Note the default differs from Microsoft's own drivers.
TrustServerCertificate - false when encrypt is set, true when it is not true skips certificate validation.
app name - go-mssqldb Application name (write it app+name or app%20name in the URL).
connection timeout - 0 (none) Seconds for the whole connection.
dial timeout - 15 per registered protocol Seconds for the TCP dial.
fedauth - - Entra methods (ActiveDirectoryDefault, ActiveDirectoryManagedIdentity, ActiveDirectoryPassword, ...) with the azuread package and the azuresql driver name.

Common SQL Server connection errors

The certificate chain was issued by an authority that is not trusted.

Why: Microsoft.Data.SqlClient 4.0+, ODBC Driver 18 and JDBC 10.2+ encrypt by default and validate the server certificate. The server is using its auto-generated self-signed certificate, or a certificate from a private CA your machine does not trust.

Fix: Install a certificate from a trusted CA on the server (or trust your internal CA on the client). If the certificate is valid but for another name, set HostNameInCertificate. For a local development server only, TrustServerCertificate=True gets you going.

Login failed for user 'app_user'. (Error 18456)

Why: Wrong password, a SQL login on a server that only allows Windows authentication, a disabled login, or a default database the login cannot open. The server log records the real reason as a state number.

Fix: Check the password, enable SQL Server and Windows Authentication mode if you use SQL logins, and set Database to one the login can open. The state in the server error log (for example State 8 = wrong password, State 38 = database not available) pinpoints it.

Keyword not supported: 'host'.

Why: Microsoft.Data.SqlClient only accepts its own keywords. Host, Username and Port are Npgsql/MySQL keywords; Provider= belongs to OLE DB connection strings; a typo like Databse fails the same way.

Fix: Use Server, User ID, and host,port. Paste the string into the decoder above: every unknown keyword is flagged.

Format of the initialization string does not conform to specification starting at index 42.

Why: A value contains ; or a quote and was not quoted, so the parser splits the string in the wrong place. Passwords are the usual culprit.

Fix: Wrap the value in double quotes and double any double quote inside: Password="p;a""ss". The builder escapes values for you.

The target principal name is incorrect. Cannot generate SSPI context.

Why: Integrated Security uses Kerberos, and the service principal name (SPN) for the SQL Server service is missing, duplicated or registered for another account, or you connected by IP address or alias.

Fix: Connect with the server's fully qualified name, and have an administrator register the SPN (setspn -L <service account> lists them). With a certificate name mismatch also check HostNameInCertificate.

SQL Server connection string FAQ

What is the default port for SQL Server?

1433 for the default instance. Named instances usually use a dynamic port that SQL Server Browser (UDP 1434) tells the client about, which is why host\instance works without a port. In ADO.NET and ODBC the port goes after a comma: Server=host,1433.

Should I use Encrypt=True or TrustServerCertificate=True?

Use Encrypt=True (or Strict on SQL Server 2022 and Azure SQL) with a certificate your clients trust. TrustServerCertificate=True keeps the traffic encrypted but stops the client from checking who it is talking to, so anyone who can intercept the connection can impersonate the server. Keep it for local development.

What changed with Encrypt in Microsoft.Data.SqlClient 4.0?

The default for Encrypt changed from false to true, and the driver validates the server certificate by default. ODBC Driver 18 and JDBC Driver 10.2 made the same change. Strings without an Encrypt keyword that used to connect without TLS now need a trusted certificate on the server.

How do I connect to Azure SQL Database with Microsoft Entra ID?

Add Authentication=Active Directory Default (picks up a managed identity, environment credentials, or your Azure CLI / Visual Studio sign-in) and leave out the password. Use Active Directory Managed Identity in Azure-hosted apps and Active Directory Interactive for a browser sign-in. Azure SQL does not accept Integrated Security=SSPI.

What is the difference between Data Source and Server, or Initial Catalog and Database?

None. They are synonyms in Microsoft.Data.SqlClient, as are User ID / UID / User and Password / PWD. If both spellings appear, the last one wins.

Does System.Data.SqlClient use the same connection string?

Mostly. It accepts the classic keywords but not newer ones such as Command Timeout, Encrypt=Strict, HostNameInCertificate or most Authentication values, and it defaults to Encrypt=False. Microsoft recommends moving to Microsoft.Data.SqlClient.

// skip the strings entirely

Connect once. Then just write SQL.

SQLly is a native SQL workbench for macOS, Windows and Linux. Paste a connection string into its connection editor, keep passwords in your system keychain, and get schema-aware IntelliSense on SQL Server and more.