SQL Server Connection String Generator
Generate connection strings for SQL Server (MSSQL) in any format. ADO.NET, JDBC, ODBC, Node.js, Python, Go, and more.
Client-side only — nothing leaves your browser
Server=localhost,1433;Database=master;User Id=sa;Password=password;Encrypt=yes;TrustServerCertificate=false
What is a SQL Server Connection String?
A SQL Server connection string contains all the information needed to connect to a Microsoft SQL Server database: server address, port (default 1433), database name, credentials, and encryption settings. Different programming languages and frameworks use different formats, from ADO.NET key-value pairs to JDBC URLs.
Encryption Options
- yes — Encrypt the connection (recommended for production)
- no — No encryption (local development only)
- strict — TDS 8.0 strict encryption (SQL Server 2022+)
Quick Reference
| Format | Example Pattern |
|---|---|
| ADO.NET / C# | Server=host,1433;Database=db;User Id=user;Password=pass;Encrypt=yes |
| JDBC (Java) | jdbc:sqlserver://host:1433;databaseName=db;user=user;password=pass |
| ODBC | Driver={ODBC Driver 18 for SQL Server};Server=host,1433;Database=db |
| Node.js (mssql) | Server=host,1433;Database=db;User Id=user;Password=pass;Encrypt=yes |
| Python (pyodbc) | Driver={ODBC Driver 18 for SQL Server};Server=host,1433;Database=db |
| Go (go-mssqldb) | sqlserver://user:pass@host:1433?database=db&encrypt=yes |
| PHP (sqlsrv) | sqlsrv:Server=host,1433;Database=db |
| Ruby (tiny_tds) | TinyTds::Client.new(host: "host", port: 1433, database: "db") |
Frequently Asked Questions
What is TrustServerCertificate in a SQL Server connection string?
TrustServerCertificate controls whether the client validates the server's TLS/SSL certificate. When set to 'true', the client skips certificate validation, which is convenient for local development but insecure for production. When set to 'false' (the default in most modern drivers), the client verifies the certificate chain against trusted CAs. For production, always use TrustServerCertificate=false with a valid certificate.
What is the difference between Windows Authentication and SQL Server Authentication in connection strings?
Windows Authentication (Integrated Security=SSPI or Trusted_Connection=Yes) uses the current Windows user's credentials, so no username or password appears in the connection string. SQL Server Authentication requires an explicit User Id and Password. Windows Authentication is generally more secure since credentials aren't stored in config files, but SQL Server Authentication is necessary for cross-platform apps and non-Windows environments like Docker or Linux.
How do I specify a port in a SQL Server connection string?
SQL Server uses a comma (not a colon) to separate host and port in most connection string formats: Server=myhost,1433. This is different from most other databases. For JDBC, use a colon instead: jdbc:sqlserver://myhost:1433. If you're using a named instance, you can omit the port and use Server=myhost\INSTANCENAME, and SQL Server Browser will resolve the port automatically.
How do I find my SQL Server connection string in SSMS?
In SQL Server Management Studio (SSMS), connect to your server, then right-click the server name in Object Explorer and select 'Properties'. The Server Properties dialog shows the host, version, and instance name. For the full connection string, check the 'Connection Properties' tab. For Azure SQL, find the connection string in the Azure Portal under your database's 'Connection strings' blade.
How do I connect to SQL Server in Docker?
Use 'localhost' with the mapped port from your host machine (e.g., Server=localhost,1433 if you mapped -p 1433:1433). The default SQL Server Docker image uses SQL Server Authentication with the SA account. Set the SA password via the SA_PASSWORD environment variable. From another container in the same Docker network, use the container name as the host: Server=mssql-container,1433.
Need a SQL Server GUI Client?
1bench is a modern database client for SQL Server and 20+ other databases. Query, browse, and manage your data visually.
Learn More