When reading data from Microsoft SQL (MS SQL) server, users of Unix-based systems need to install a MS ODBC driver that is compatible with the version of their target server. For example, ODBC Driver 17 is compatible with SQL server 2019, version 15.0.
After choosing the appropriate driver, open the terminal, and run these instructions to install the MS SQL ODBC driver on Mac.
driver=17
brew install unixodbc
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
brew install msodbcsql${driver}
brew install mssql-tools
ODBCSYSINI=/
Note that this requires Ubuntu 16.04 and above. Choose the appropriate driver, open the terminal and type the instructions below:
Ubuntu
driver=17
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql${driver}
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install -y unixodbc-dev
Ubuntu
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql
sudo ACCEPT_EULA=Y apt-get install mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install unixodbc-dev
To install an MS SQL driver for other Linux distributions, such as Debian and Fedora, click here and follow the instructions. After the installation, check the installed drivers using:
If this command does not return the list of installed drivers or if you are facing issues during the driver installation process, consult the odbc github page or the MS documentation on this topic.
It is also important to view the data stored in the MS SQL server.
For that purpose, we recommend you to install a graphical user interface
(GUI) such as Azure Data Studio
.