> ## 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.

# Grafana

> This page outlines the steps to connect Grafana 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 Grafana to the Connect AI Virtual SQL Server API, follow these steps.

<Steps>
  <Step>
    Download and install Grafana for your operating system from the [Grafana website](https://www.grafana.com/).
  </Step>

  <Step>
    Once installed, access Grafana at `http://localhost:3000/`.
  </Step>

  <Step>
    Log in to Grafana with your username and password for Grafana. If this is your first time logging in, the username is *admin* and the password is *admin*.
  </Step>

  <Step>
    On the navigation menu, click **Connections** > **Add new connection**.

    <Frame>
      <img src="https://mintcdn.com/cdata/6FDv4aMDihHt3ws_/en/images/grafana_client_add_connection.png?fit=max&auto=format&n=6FDv4aMDihHt3ws_&q=85&s=bd6de6e0ea7226f245a0f2655b782e99" alt="" width="1755" height="650" data-path="en/images/grafana_client_add_connection.png" />
    </Frame>
  </Step>

  <Step>
    Search for **Microsoft SQL Server** as your data source.
  </Step>

  <Step>
    Click **Add new data source**.

    <Frame>
      <img src="https://mintcdn.com/cdata/6FDv4aMDihHt3ws_/en/images/grafana_client_add_data_source.png?fit=max&auto=format&n=6FDv4aMDihHt3ws_&q=85&s=7ab03ff4033fb5e9bfb218f58bde577c" alt="" width="1347" height="134" data-path="en/images/grafana_client_add_data_source.png" />
    </Frame>
  </Step>

  <Step>
    (Optional) Enter a new name for the data source.
  </Step>

  <Step>
    Enter the following connection settings.

    * **Host**—*tds.cdata.com*:*14333*
    * **Database**—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.

    <Frame>
      <img src="https://mintcdn.com/cdata/6FDv4aMDihHt3ws_/en/images/grafana_client_connection_settings.png?fit=max&auto=format&n=6FDv4aMDihHt3ws_&q=85&s=8526250b8a445d4c96f72298180c4e56" alt="" width="667" height="549" data-path="en/images/grafana_client_connection_settings.png" />
    </Frame>
  </Step>

  <Step>
    Click **Save & test**. A **Database Connect OK** message appears.
  </Step>

  <Step>
    On the navigation menu, click **Explore**.
  </Step>

  <Step>
    Select the connection you created. Choose the tables and columns you want to query.

    <Frame>
      <img src="https://mintcdn.com/cdata/6FDv4aMDihHt3ws_/en/images/grafana_client_view_data.png?fit=max&auto=format&n=6FDv4aMDihHt3ws_&q=85&s=de68667f26311dfd772f109b1f892356" alt="" width="1361" height="664" data-path="en/images/grafana_client_view_data.png" />
    </Frame>
  </Step>

  <Step>
    Run the query and visualize your data as you want.

    <Frame>
      <img src="https://mintcdn.com/cdata/6FDv4aMDihHt3ws_/en/images/grafana_client_query_results.png?fit=max&auto=format&n=6FDv4aMDihHt3ws_&q=85&s=2d6fe8bd695f1cfd4e20399def4c9815" alt="" width="1352" height="902" data-path="en/images/grafana_client_query_results.png" />
    </Frame>
  </Step>
</Steps>
