---
metadata:
  - name: generator
    content: Diplodoc Platform v5.63.0
alternate:
  - en/operations/connection/create-mssql-server
  - ru/operations/connection/create-mssql-server
  - href: en/operations/connection/create-mssql-server.md
    type: text/markdown
    title: Markdown version
csp:
  - script-src:
      - https://mc.yandex.ru
    img-src:
      - https://mc.yandex.ru
    connect-src:
      - https://mc.yandex.ru
      - wss://mc.yandex.ru
    child-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-src:
      - 'blob:'
      - https://mc.yandex.ru
    frame-ancestors:
      - 'blob:'
      - https://mc.yandex.ru
canonical: en/operations/connection/create-mssql-server.html
title: How to create a SQL Server connection in DataLens On-premises
description: >-
  In this tutorial, you will learn how to connect to SQL Server in DataLens
  On-premises.
vcsPath: en/operations/connection/create-mssql-server.md
---

# Creating a connection to SQL Server in DataLens On-premises


To create an SQL Server connection:


1. Go to the [workbook](../../workbooks-collections/index.md) page or create a new one.
1. In the top-right corner, click **Create** → **Connection**.
1. Select **MS SQL Server** as the connection type.
1. Specify the connection parameters for the external **MS SQL Server** database:


   * **Host name**: Specify the path to a master host or a SQL Server master host IP address. You can specify multiple hosts in a comma-separated list. If you fail to connect to the first host, DataLens will select the next one from the list.
   * **Port**: Specify the SQL Server connection port. The default port is 1433.
   * **Path to database**: Specify the database name.
   * **Username**: Specify a username for the SQL Server connection.
   * **Password**: Enter the password for the specified user.
   * **Cache TTL in seconds**: Specify cache TTL or leave the default value. The recommended value is 300 seconds (5 minutes).

   
   * **Raw SQL level**: Enables you to use an ad-hoc SQL query to [generate a dataset](../../dataset/settings.md#sql-request-in-datatset).


1. Optionally, test the connection by clicking **Check connection**.
1. Click **Create connection**.


1. Select a [workbook](../../workbooks-collections/index.md) to save your connection to or create a new one. If using legacy folder navigation, select a folder to save the connection to. Click **Create**.


1. Enter a name for the connection and click **Create**.


## Additional settings {#additional-settings}

<!-- source: en/_includes/datalens/operations/datalens-db-connection-export-settings.md -->
You can limit data export from charts by enabling the **Disable data export** option under **Advanced connection settings**. Thus, for charts based on the respective connection, the export data option will not be available in their <!-- diplodoc:svg ![icon](../../_assets/console-icons/ellipsis.svg) --><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="currentColor" fill-rule="evenodd" d="M3 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3M9.5 8a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m5 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0" clip-rule="evenodd"/></svg> menu. However, you will still be able to copy chart data and take screenshots.
<!-- endsource: en/_includes/datalens/operations/datalens-db-connection-export-settings.md -->
