0

I'm trying to connect to a SQL Server database using a python script. I'm using the pyodbc library to connect to it.

cnxn = pyodbc.connect('DRIVER={SQL Driver}; SERVER=192.168.80.30 ;DATABASE=users;UID=data;PWD=xxxx')

When running the script with the above connection configuration I get:

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

It seems that I don't have the SQLDriver installed. Doing some research I haven't found a driver that works. Which ODBC driver should I install on the Raspberry Pi? I'm using Raspbian.

2

I believe you are looking for FreeTDS or for pymssql. From pymssql docs:

A simple database interface for Python that builds on top of FreeTDS to provide a Python DB-API (PEP-249) interface to Microsoft SQL Server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.