Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure pymssql with SSL support on Ubuntu?

What were the steps required to configure (the now discontinued) pymssql with SSL support on Ubuntu so I can connect to a SQL Server instance that requires an encrypted connection (e.g., Azure)?

like image 683
Gord Thompson Avatar asked Nov 30 '22 16:11

Gord Thompson


1 Answers

Ubuntu 18.04 LTS

The Ubuntu 18.04 repositories will install a version of FreeTDS that supports GnuTLS so it is not absolutely necessary to build FreeTDS from source. However, we still need to build pymssql from source because simply doing the usual

pip3 install --user pymssql

will install a pre-compiled "wheel" that does not support secure connections. Instead, we need to do

sudo apt install python3-pip freetds-dev
pip3 install --user Cython
pip3 install --user --no-binary pymssql pymssql
like image 114
Gord Thompson Avatar answered Dec 03 '22 06:12

Gord Thompson