Connect to Microsoft SQL Server
Connect Microsoft SQL Server to Retool to query data, manage records, and build apps and automations with T-SQL.
Microsoft SQL Server is a relational database management system. You can create a Microsoft SQL Server resource to securely connect to your databases and create apps and automations that use T-SQL queries to perform create, read, update, and delete operations.
What you can do with Microsoft SQL Server in Retool
- Query with T-SQL: Write T-SQL queries with joins, aggregations, subqueries, common table expressions (CTEs), and window functions using SQL mode for reading data.
- Manage data: Insert, update, and delete records using GUI mode for write operations.
- Execute transactions: Perform multi-statement transactions with automatic rollback on errors.
- Call stored procedures: Execute SQL Server stored procedures with parameters and return values.
- Connect to Azure: Query Azure SQL Database, Azure SQL Managed Instance, and other Azure-hosted SQL Server instances.
Before you begin
To connect Microsoft SQL Server to Retool, you need the following:
- Cloud
- Self-hosted
- SQL Server instance: An accessible Microsoft SQL Server instance (SQL Server 2008 or later recommended).
- Network access: Your SQL Server must accept connections from Retool's IP addresses.
- Database credentials: A SQL Server login with appropriate permissions for the databases your apps will query.
- Retool permissions: Own permissions for resources in your organization.
- SQL Server instance: An accessible Microsoft SQL Server instance (SQL Server 2008 or later recommended).
- Network access: Your Retool instance must be able to reach your SQL Server.
- Database credentials: A SQL Server login with appropriate permissions for the databases your apps will query.
- SSH tunnel (optional): If your database is not publicly accessible, configure an SSH tunnel.
- Retool permissions: Own permissions for resources in your organization.
Create a Microsoft SQL Server resource
Follow these steps to create a Microsoft SQL Server resource in your Retool organization.
1. Create a new resource
In your Retool organization, navigate to Resources in the main navigation and click Create new → Resource. Search for Microsoft SQL Server and click the Microsoft SQL Server tile to begin configuration.
Use folders to organize your resources by team, environment, or data source type. This helps keep your resource list manageable as your organization grows.
2. Configure general settings
Specify a name and description for the resource that indicates which database it connects to. The description provides more context to users about how to use the resource.
| Example name | Example description |
|---|---|
SQL Server (readonly) | A read-only SQL Server database with customer and order information. |
SQL Server Prod | Production Microsoft SQL Server instance. Use for incident tracking and operational data. |
Connector version
Microsoft SQL Server resources use connector version 3.0, which determines the underlying driver behavior.
Connector version 3.0 accepts array values in query parameters and converts them to comma-separated strings before passing them to SQL Server. Query parameters set to an object are not supported and cause the query to fail. Convert an object to a string before using it in a query, for example with JSON.stringify.
3. Configure resource credentials
Configure the connection settings for your Microsoft SQL Server resource.
You can autofill the configuration fields using a Microsoft SQL Server connection string or by importing an existing AWS resource for RDS SQL Server instances.
Server=myserver.database.windows.net,1433;Database=mydb;User Id=myuser;Password=mypassword;
Host
The hostname or IP address of your SQL Server instance.
myserver.database.windows.net
sqlserver-instance.c.my-project.internal
sqlserver.example.com
192.168.1.100
Port
The port number for your SQL Server instance. Default is 1433.
Database name
The name of the database to connect to. Leave blank to connect to the default database for the login.
Connection options
Additional connection parameters. Add custom options as key-value pairs.
encrypt=true
trustServerCertificate=false
connectionTimeout=30
requestTimeout=15000
If you use Windows authentication, connection options are limited to an approved set of ODBC attributes. Retool sets Encrypt, Trusted_Connection, and other security-sensitive settings for you. Configure encryption and certificate verification under SSL/TLS. Do not add encrypt or trustServerCertificate to connection options.
Unsupported keys cause resource setup to fail with an error like Unsupported MSSQL ODBC connection string parameter "<key>". To check whether an existing resource relies on blocked parameters before upgrading, search deployment logs for MSSQL Windows Auth ODBC connection string parameter not on allowlist.
Refer to unsupported ODBC connection params for the allowlist and upgrade guidance.
TDS version
The Tabular Data Stream (TDS) protocol version used to communicate with SQL Server. Select the version that matches your SQL Server version.
| Version | SQL Server version |
|---|---|
| 7.1 | SQL Server 2000 |
| 7.2 | SQL Server 2005 |
| 7.3a | SQL Server 2008 |
| 7.3b | SQL Server 2008 R2 |
| 7.4 | SQL Server 2012 and later (default) |
Leave this at the default (7.4) unless you need to connect to an older SQL Server version.
SSH tunnel
If your SQL Server is not publicly accessible, configure an SSH tunnel to connect through a bastion host. Provide SSH host, port, username, and authentication method (password or private key).
SQL Server proxy host
If your network routes SQL Server connections through a proxy, specify the proxy server hostname here.