sss
sss

Reputation: 81

Install Microsoft ODBC Driver 13 for SQL Server in Ubuntu 16.04

I am trying to install ODBC Driver 13 on Ubuntu 16.04 but after installation still, the driver is missing. I followed the steps from this page, but when I want to connect, the driver still missing.

Below code is also return empty array:

import pyodbc
print(pyodbc.drivers())

Furthermore when I want to install via:

wget https://gallery.technet.microsoft.com/ODBC-Driver-13-for-Ubuntu-b87369f0/file/154097/2/installodbc.sh

inside of the installodbc.sh the part below gives me an error which cannot find the ./install.sh:

echo "Installing the Microsoft ODBC Driver 13 for SQL Server- Ubuntu"
sudo bash ./install.sh install --force --accept-license
echo "Cleaning up"
rm -rf /tmp/msodbcubuntu

Does anyone know how to fix this issue? I tried all the possible answers on the internet still the driver is missing and I can't establish the connection.

Upvotes: 2

Views: 16372

Answers (2)

kenorb
kenorb

Reputation: 166319

You need to configure the path to your driver by creating ~/.odbcinst.ini, e.g.

[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/usr/local/lib/libmsodbcsql.13.dylib

Note: Above is the example taken from macOS.

Where /usr/local/lib/libmsodbcsql.13.dylib is the filepath to your libmsodbcsql library file (e.g. on Linux it's libmsodbcsql-13.1.so.9‌​‌​.0‌​).

Upvotes: 0

Boboyum
Boboyum

Reputation: 708

There are up to date instructions on how to set up SQLServer and ODBC on Ubuntu for Python Development at https://www.microsoft.com/en-us/sql-server/developer-get-started/python/ubuntu/

This is maintained by the SQL Server Product team.

The latest instructions for installing ODBC can be found at https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server#microsoft-odbc-driver-131-for-sql-server

Upvotes: 1

Related Questions