> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cloud.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mode

> This page outlines the steps to connect Mode to the Connect AI Virtual SQL Server API.

## Prerequisites

Before you connect, you must first do the following:

* Connect a data source to your Connect AI account. See [Sources](/en/Sources) for more information.
* Generate a Personal Access Token (PAT) on the [Settings](/en/Settings#personal-access-tokens) page. Copy this down, as it acts as your password during authentication.

## Connect to Connect AI

To establish a connection from Mode to the Connect AI Virtual SQL Server API, follow these steps.

<Steps>
  <Step>
    Log in to Mode.
  </Step>

  <Step>
    On the **Discover** page of Mode, click **Connect a Database**.

    <Frame>
      <img src="https://mintcdn.com/cdata/rskOtmB_oKRs4KNs/en/images/mode_client_connect_database.png?fit=max&auto=format&n=rskOtmB_oKRs4KNs&q=85&s=524ddf7e5abc30343212923f4cb66e7c" alt="Mode Client Connect Database" width="668" height="679" data-path="en/images/mode_client_connect_database.png" />
    </Frame>
  </Step>

  <Step>
    On the next screen, select **Microsoft SQL Server**.

    <Frame>
      <img src="https://mintcdn.com/cdata/rskOtmB_oKRs4KNs/en/images/mode_client_sql_server.png?fit=max&auto=format&n=rskOtmB_oKRs4KNs&q=85&s=f66e3039c78381b5448a19a6863c82e0" alt="Mode Client SQL Server" width="1003" height="866" data-path="en/images/mode_client_sql_server.png" />
    </Frame>
  </Step>

  <Step>
    Enter the following Microsoft SQL Server settings.

    * **Display name**—enter the name of your connection for display purposes.
    * **Host**—*tds.cdata.com*
    * **Port**—*14333*
    * **Database name**—enter the Connection Name of the Connect AI data source you want to connect to (for example, *Salesforce1*).
    * **Username**—enter your Connect AI username. This is displayed in the top-right corner of the Connect AI interface. For example, *[test@cdata.com](mailto:test@cdata.com)*.
    * **Password**—enter the PAT you generated on the [Settings](/en/Settings#personal-access-tokens) page.
      Leave the rest of the connections settings at their default values unless you need to modify them.

    <Frame>
      <img src="https://mintcdn.com/cdata/rskOtmB_oKRs4KNs/en/images/mode_client_connection_credentials.png?fit=max&auto=format&n=rskOtmB_oKRs4KNs&q=85&s=6ae490bb1461b89e790f037c77554227" alt="Mode Client Connection Credentials" width="616" height="1077" data-path="en/images/mode_client_connection_credentials.png" />
    </Frame>
  </Step>

  <Step>
    Click **Connect**. If the connection succeeds, a success message appears. Your connection is now available for use in Mode.
  </Step>

  <Step>
    Repeat the steps above to connect to additional Connect AI sources, changing the **Database name** for each one.
  </Step>
</Steps>

You can now create a Mode visualization with the Connect AI data. Follow the steps below.

<Steps>
  <Step>
    After your connection succeeds, click **New Report**. The SQL query text editor appears.

    <Frame>
      <img src="https://mintcdn.com/cdata/rskOtmB_oKRs4KNs/en/images/mode_client_create_report.png?fit=max&auto=format&n=rskOtmB_oKRs4KNs&q=85&s=317ceb9c40c0dd5c97798b1025aecabd" alt="Mode Client Create Report" width="1615" height="448" data-path="en/images/mode_client_create_report.png" />
    </Frame>
  </Step>

  <Step>
    Enter a SQL query for your data, such as:
  </Step>
</Steps>

```sql theme={null}
SELECT * FROM [Sharepoint].[MyCustomList];
```

<Steps>
  <Step>
    Click **Run** to run the query. The data appears below.
  </Step>

  <Step>
    Click **+New chart** to create visualizations from the data.

    <Frame>
      <img src="https://mintcdn.com/cdata/rskOtmB_oKRs4KNs/en/images/mode_client_create_chart.png?fit=max&auto=format&n=rskOtmB_oKRs4KNs&q=85&s=18bf76c514f6bee537a849214e612281" alt="Mode Client Create Chart" width="1593" height="994" data-path="en/images/mode_client_create_chart.png" />
    </Frame>
  </Step>
</Steps>
