SQL Server connection string builder

Fill in what you need; the string uses SqlConnectionStringBuilder's keywords and quoting, with the appsettings.json and environment variable versions underneath.

Checked with Microsoft.Data.SqlClient's SqlConnectionStringBuilder (7.0.0.0): it reads every string this page makes back to the same keywords and values, including passwords with ; ' and ". Your password stays in your browser.

Using PostgreSQL? See the Npgsql connection string builder.

Questions

Server or Data Source? Database or Initial Catalog?

They are synonyms. SqlConnectionStringBuilder accepts Server, Database, User Id, uid, pwd and Trusted_Connection, and writes them back as Data Source, Initial Catalog, User ID, Password and Integrated Security. This page uses the builder’s own names.

When is a value put in quotes?

When it contains a semicolon, an equals sign, a quote or a space, as SqlConnectionStringBuilder does. A value with double quotes but no single quotes is wrapped in single quotes; otherwise it is wrapped in double quotes with any double quote doubled.

What do the Encrypt values mean?

True (mandatory), False (optional) and Strict. Leave it unset to use the driver’s default.

Is a misspelt keyword caught?

Yes by the driver: SqlConnectionStringBuilder throws “Keyword not supported: 'bogus'.” for an unknown keyword. This builder only writes keywords the driver knows.

More tools

Runs in your browser: nothing you paste is sent anywhere. Not affiliated with Microsoft, the .NET Foundation or the library authors.