The Microsoft SQL Server connection string follows the JDBC standard

The following example uses integrated security (Windows only):

sqlserver://HOST:PORT;database=DATABASE;integratedsecurity=true

The following example uses SQL authentication (username and password):

sqlserver://HOST:PORT;database=DATABASE;user=USER;password=PASSWORD

Note: If you are connecting from MacOS, add encrypt=DANGER_PLAINTEXT to disable TLS and make it easier to work in . Do not do this in production.

Arguments

Argument nameRequiredDefaultComments
database
initial catalog
NomasterThe database to connect to.
username
user
uid
userid
No - see CommentsSQL Server login (such as sa) or a valid Windows (Active Directory) username if integratedSecurity is set to true (Windows only).
password
pwd
No - see CommentsPassword for SQL Server login or Windows (Active Directory) username if integratedSecurity is set to true (Windows only).
encryptNoConfigures whether to use TLS, possible values: true, false, DANGER_PLAINTEXT
integratedSecurityNoEnables Windows authentication (integrated security), possible values: true, false, yes, no. If set to true or yes and username and password are present, login is performed through Windows Active Directory. If login details are not given via separate arguments, the current logged in Windows user is used to login to the server.
schemaNodboAdded as a prefix to all the queries if schema name is not the default.
loginTimeout
connectTimeout
connectionTimeout
NoNumber of seconds to wait for login to succeed.
socketTimeoutNoNumber of seconds to wait for each query to succceed.
isolationLevelNoSets transaction isolation level.

Scenarios

Using integrated security (Windows only)

The following example uses the currently logged in Windows user to log in to SQL Server:

sqlserver://localhost:1433;initialCatalog=sample;integratedSecurity=true;trustServerCertificate=true;

The following example uses a specific Active Directory user to log in to SQL Server:

sqlserver://localhost:1433;initialCatalog=sample;integratedSecurity=true;username=prisma;password=aBcD1234;trustServerCertificate=true;

Using SQL Browser to connect to a named instance

The following example connects to a named instance of SQL Server (mycomputer\sql2019) using integrated security:

sqlserver://mycomputer\sql2019;initialCatalog=sample;integratedSecurity=true;trustServerCertificate=true;
Edit this page on GitHub