VOOZH about

URL: https://www.cdata.com/kb/tech/sql-cloud-chatgpt.rst

⇱ Use ChatGPT to Talk to Your SQL Server Data via CData Connect AI


Use ChatGPT to Talk to Your SQL Server Data via CData Connect AI

πŸ‘ Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Leverage the CData Connect AI Remote MCP Server to enable ChatGPT to securely answer questions and take actions on your SQL Server data for you.

ChatGPT is an AI chatbot developed by OpenAI, launched in November 2022. Based on large language models (LLMs), it enables users to refine and steer conversations through natural language processing. ChatGPT's developer mode, available to Plus and Pro subscribers, provides full Model Context Protocol (MCP) support for connecting to external data sources and tools.

CData Connect AI offers a dedicated cloud-to-cloud interface for connecting to SQL Server data. The CData Connect AI Remote MCP Server enables secure communication between ChatGPT and SQL Server. This allows you to ask questions and take actions on your SQL Server data using ChatGPT, all without the need for data replication to a natively supported database. With its inherent optimized data processing capabilities, CData Connect AI efficiently channels all supported SQL operations, including filters and JOINs, directly to SQL Server. This leverages server-side processing to swiftly deliver the requested SQL Server data.

Step 1: Configure SQL Server Connectivity for ChatGPT

Connectivity to SQL Server from ChatGPT is made possible through CData Connect AI Remote MCP. To interact with SQL Server data from ChatGPT, we start by creating and configuring a SQL Server connection in CData Connect AI.

  1. Log into your Connect AI account, click Sources, and then click Add Connection.
  2. πŸ‘ Adding a Connection
  3. Select "SQL Server" from the Add Connection panel.
  4. πŸ‘ Selecting a data source
  5. Enter the necessary authentication properties to connect to SQL Server.

    Connecting to Microsoft SQL Server

    Connect to Microsoft SQL Server using the following properties:

    • Server: The name of the server running SQL Server.
    • User: The username provided for authentication with SQL Server.
    • Password: The password associated with the authenticating user.
    • Database: The name of the SQL Server database.

    Connecting to Azure SQL Server and Azure Data Warehouse

    You can authenticate to Azure SQL Server or Azure Data Warehouse by setting the following connection properties:

    • Server: The server running Azure. You can find this by logging into the Azure portal and navigating to "SQL databases" (or "SQL data warehouses") -> "Select your database" -> "Overview" -> "Server name."
    • User: The name of the user authenticating to Azure.
    • Password: The password associated with the authenticating user.
    • Database: The name of the database, as seen in the Azure portal on the SQL databases (or SQL warehouses) page.

    SSH Connectivity for SQL Server

    You can use SSH (Secure Shell) to authenticate with SQL Server, whether the instance is hosted on-premises or in supported cloud environments. SSH authentication ensures that access is encrypted (as compared to direct network connections).

    SSH Connections to SQL Server in Password Auth Mode

    To connect to SQL Server via SSH in Password Auth mode, set the following connection properties:

    • User: SQL Server User name
    • Password: SQL Server Password
    • Database: SQL Server database name
    • Server: SQL Server Server name
    • Port: SQL Server port number like 3306
    • UserSSH: "true"
    • SSHAuthMode: "Password"
    • SSHPort: SSH Port number
    • SSHServer: SSH Server name
    • SSHUser: SSH User name
    • SSHPassword: SSH Password

    SSH Connections to SQL Server in Public Key Auth Mode

    To connect to SQL Server via SSH in Password Auth mode, set the following connection properties:

    • User: SQL Server User name
    • Password: SQL Server Password
    • Database: SQL Server database name
    • Server: SQL Server Server name
    • Port: SQL Server port number like 3306
    • UserSSH: "true"
    • SSHAuthMode: "Public_Key"
    • SSHPort: SSH Port number
    • SSHServer: SSH Server name
    • SSHUser: SSH User name
    • SSHClientCret: the path for the public key certificate file
    πŸ‘ Configuring a connection (Salesforce is shown)
  6. Click Save & Test

With the connection configured, we are ready to connect to SQL Server data from ChatGPT.

Step 2: Connect ChatGPT to CData Connect AI

Follow these steps to add a CData Connect AI connection in ChatGPT:

  1. Sign in to ChatGPT with a Plus or Pro subscription.
  2. Navigate to Apps from the left panel.
  3. Select the CData Connect AI app from the list.
  4. . πŸ‘ Search for CData Connect AI
  5. Click Connect to authenticate to your Connect AI account.
  6. πŸ‘ Click Connect to authenticate
  7. Click Sign in with CData Connect AI to add Connect AI to your ChatGPT account.
  8. πŸ‘ Sign in with CData Connect AI
  9. After successful authorization, you will be redirected back to ChatGPT.
  10. Click Start Chat to start a new conversation in ChatGPT with Connect AI connected at the background.
  11. πŸ‘ Start Chat

Step 3: Explore Live SQL Server Data with ChatGPT

  1. Start a new conversation in ChatGPT.
  2. Connect AI should ideally be automatically enabled in the chat. If not, navigate to -> More -> CData Connect AI, under the chatbox, to enable the connector from the dropdown
  3. πŸ‘ Enable CData Connect AI in the chat
  4. You can now start exploring your data with natural language prompts. ChatGPT will use the Connect AI MCP server to query your live SQL Server data. Example prompts:
    • "Show me all customers from the last 30 days"
    • "What are my top performing products?"
    • "Analyze sales trends for this quarter"
    • "List all active projects and their current status"
    Refer to CData prompt library for more prompt ideas.
  5. πŸ‘ Using natural language to explore your SQL Server data (Salesforce used here).
  6. Permit ChatGPT to access your SQL Server data. Click Query Data to continue, or Deny to refuse.
  7. πŸ‘ Give permissions to ChatGPT.
  8. ChatGPT translates your natural language queries into SQL and execute them against your SQL Server data through the Connect AI MCP server.
  9. πŸ‘ ChatGPT shows the desired results from your SQL Server data based on the prompts

Get CData Connect AI

To get live data access to hundreds of SaaS, Big Data, and NoSQL sources directly from your cloud applications, try CData Connect AI today!