Found on the Internet Pyodbc This module, my operating system is Ubuntu 16.04, Python 2.7 has been installed PIP
Follow the official documentation steps to install successfully.
But cross-platform is required.
Using PYODBC to connect to SQL Server in Windows is straightforward.
Pyodbc.connect (' Driver={sql Server}; Server=192.168.1.15;database=master; Uid=sa; Pwd=password ')
But I am in Ubuntu and need to install the following components:
Microsoft ODBC Driver for SQL Server on Linux
The 13 version of the component supports Ubuntu, before the 11 version supports CentOS and Redhat, and decisively installs version 13.
According to https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/ Installing-the-microsoft-odbc-driver-for-sql-server Step installs the component,
Then follow the Https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-RHEL-or-Centos steps to finish the call.
I thought it was time to call it off, but when I pyodbc.connect (' Driver={odbc DRIVER for SQL Server}; Server=192.168.1.15;database=master; Uid=sa; Pwd=password ') unexpectedly shows no support for sqlserver2000!!! What fuck!!
Then another module was used: pymssql
This time finally succeeded.
Reference
https://www.tomczhen.com/2017/05/25/python-cross-platform-connect-to-sqlserver/
Https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server
Https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-RHEL-or-Centos
Python Operations SQL Server 2000