I\'m trying to connect to an MSSQL database from python on Linux (SLES).
I have installed pyodbc and Free TDS. From the command line:
tsql -H server
I had the same problem and I found out that it was missing the TDS_Version
parameter in the call to connect()
. The following code works for me to connect to an instance of MS SQL Server 2008:
import pyodbc
driver = '/opt/local/lib/libtdsodbc.so' # Change this to where FreeTDS installed the driver libaray!
conn = pyodbc.connect(
driver = driver,
TDS_Version = '7.2', # Use for
server = '',
port = 1433,
database = '',
uid = '',
pwd = '')