Prerequisites
Before proceeding, ensure the following prerequisites are met:- Install MindsDB locally via Docker or Docker Desktop.
- To connect Microsoft SQL Server to MindsDB, install the required dependencies following this instruction.
Connection
Establish a connection to your Microsoft SQL Server database from MindsDB by executing the following SQL command:user
: The username for the Microsoft SQL Server.password
: The password for the Microsoft SQL Server.host
The hostname, IP address, or URL of the Microsoft SQL Server.database
The name of the Microsoft SQL Server database to connect to.
port
: The port number for connecting to the Microsoft SQL Server. Default is 1433.server
: The server name to connect to. Typically only used with named instances or Azure SQL Database.
Usage
Retrieve data from a specified table by providing the integration name, schema, and table name:The above examples utilize
mssql_datasource
as the datasource name, which is defined in the CREATE DATABASE
command.Troubleshooting Guide
Database Connection Error
- Symptoms: Failure to connect MindsDB with the Microsoft SQL Server database.
- Checklist:
- Make sure the Microsoft SQL Server is active.
- Confirm that host, port, user, and password are correct. Try a direct Microsoft SQL Server connection using a client like SQL Server Management Studio or DBeaver.
- Ensure a stable network between MindsDB and Microsoft SQL Server.
SQL statement cannot be parsed by mindsdb_sql
- Symptoms: SQL queries failing or not recognizing table names containing spaces or special characters.
- Checklist:
- Ensure table names with spaces or special characters are enclosed in backticks.
- Examples:
- Incorrect: SELECT * FROM integration.travel data
- Incorrect: SELECT * FROM integration.‘travel data’
- Correct: SELECT * FROM integration.`travel data`