In my python 3.7 + Django 2.2 I need to connect to external SQL Server. Its not the main DB of Django (that remains in Postgres). I only need to make some query on a view.
Im on Debian 9 and Im trying to install package to add sql server connection but I cant find on google a guide about Debian package to install.
I try to install:
pip install pyodbc
pip install django-mssql-backend
but the compile failed. I think Im missing some system libraries.
UPDATE 1
apt-get install unixodbc-dev
pip install pyodbc
pip install django-mssql-backend
This solved the library installation. Now I got problem when trying to connect to DB:
Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
Thanks.
You're missing the underlying drivers which allow
unixodbc
to connect to SQL Server. You can find instructions to install the Microsoft ODBC driver here.The short version for Debian, from the link:
Good luck!