docs/versioned_docs/version-3.0.0-LTS/data-sources/mssql.md
ToolJet can connect to MS SQL Server & Azure SQL databases to read and write data.
<div style={{paddingTop:'24px'}}>To establish a connection with the MS SQL Server data source, click on the + Add new Data source button located on the query panel or navigate to the Data Sources page from the ToolJet dashboard.
:::info Please make sure the Host/IP of the database is accessible from your VPC if you have self-hosted ToolJet. If you are using ToolJet cloud, please whitelist our IP. :::
ToolJet requires the following to connect to your PostgreSQL database.
Note: It is recommended to create a new database user so that you can control the access levels of ToolJet.
You can add optional configurations in key-value pairs for the MS SQL data source connection.
| Key | Value |
|---|---|
| trustServerCertificate | true |
These options allow you to fine-tune the connection, such as enabling encryption when using a self-signed certificate.
To enhance security during data transfer, encryption can be enabled even with a self-signed certificate.
trustServerCertificate to true.
Once the SQL data source is added, you can create queries to read and write data to the database. You can create queries from the Query Panel located at the bottom panel of the app builder.
SQL mode can be used to query MS SQL Server / Azure SQL Databases using SQL queries.
SELECT * FROM users
ToolJet offers support for parameterized SQL queries, which enhance security by preventing SQL injection and allow for dynamic query construction. To implement parameterized queries:
:parameter_name as placeholders in your SQL query where you want to insert parameters.{{ }} notation.Query: SELECT * FROM users WHERE username = :username
SQL Parameters:
Key: username
Value: oliver // or {{ components.username.value }}
You can set the timeout duration for SQL queries by adding the PLUGINS_SQL_DB_STATEMENT_TIMEOUT variable to the environment configuration file. By default, it is set to 120,000 ms.
GUI mode can be used to query MS SQL Server / Azure SQL Databases without writing queries.
{{ [ {id: 1, channel: 33}, {id: 2, channel: 24} ] }}
:::tip Query results can be transformed using transformations. Read our transformations documentation to see how: link :::
</div>