# Add a Microsoft SQL (MSSQL) Server connector

## Connector features

You can use the Toucan Microsoft SQL Server (MSSQL) connector to connect to your MSSQL account with a basic authentication and access `tables` with a SQL query.

With this connection, you can fetch data from your MSSQL to fill your charts and dashboards.

{% hint style="info" %}
**Changelog**

**April 25**\
\- This connector supports the option Trust server certificate

**October 25**\
\- This data connector is supported for connection and [NativeSQL](/data-management-in-datahub/datasources-in-toucan/managing-connectors/create-a-dataset-from-a-connector/code-mode-and-single-mode.md) by our new
{% endhint %}

## Configuring a Microsoft Server SQL connector (MSSQL ) connection

Follow the steps described in [Add a connector](/data-management-in-datahub/datasources-in-toucan/managing-connectors/setting-up-a-connector.md), choose `MSSQL` and fill out the form with the following info:

| Field                                          | Format / Type | Description                                                                                                                                                                                                                                                                             | Example                                 |
| ---------------------------------------------- | ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
| Name (mandatory)                               | String        | Use it to identify your connection                                                                                                                                                                                                                                                      | *MyMsSQLConnection*                     |
| Host (mandatory)                               | String        | The domain name or IP address of your database server                                                                                                                                                                                                                                   | "*db.example.com*" or "*192.168.1.100*" |
| Port (optional)                                | Integer       | The listening port of your database server                                                                                                                                                                                                                                              | *1433*                                  |
| User (mandatory)                               | String        | Your login username                                                                                                                                                                                                                                                                     | *my\_user*                              |
| Password (mandatory)                           | String        | Your login password                                                                                                                                                                                                                                                                     | *my\_password*                          |
| Connect Timeout (optional)                     | Integer       | Connection timeout in seconds                                                                                                                                                                                                                                                           | *30*                                    |
| Trust server certificate (optional)            | Boolean       | Disable server certificate validation, can be used if the certificate used is untrusted. Connexion stays encrypted                                                                                                                                                                      |                                         |
| Retry Policy (optional)                        | Boolean       | <p><em>Boolean</em> allows to configure a retry policy if the connection is flaky.</p><ul><li>max attempts: maximum number of retries before giving up</li><li>max\_delay: in seconds, above the connection is dropped</li><li>wait\_time: time in seconds between each retry</li></ul> |                                         |
| Slow Queries' Cache Expiration Time (optional) | Integer       | Slow queries' cache expiration time in seconds                                                                                                                                                                                                                                          |                                         |

Click on the `TEST CONNECTION` button then `SAVE` the connection

{% hint style="success" %}
After successfully configuring the connector, you will be able to find it in the Connector section of the DataHub "Datasource" tab
{% endhint %}

## Create a dataset from a MSSQL connection

To create a dataset from MSSQL, click on the "create a new dataset from this connector", you will then be able to:

* Select the `Database`
* Select the `Table`
* and write your SQL query in `Query`

The fields: `Validation rules`, `Parameters`,`Slow queries cache expiration time` are optional

{% hint style="info" %}
After selecting data from your connector you will be able to create a dataset thanks to YouPrep

For more info, see the dedicated section [Creating datasets](/data-management-in-datahub/datasets-in-toucan.md)
{% endhint %}

{% hint style="warning" %}
**Additional** **notes**

* We use for the the MSSQL connector uses the ODBC Driver 18 for SQL Server
* SQL Server will use the default database for the user
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-v3.toucantoco.com/data-management-in-datahub/datasources-in-toucan/managing-connectors/setting-up-a-connector/database-and-data-warehouse-connectors/setting-up-a-microsoft-sql-server-connector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
