0

I've written a python script on my raspberry pi (OS: Raspbian) that I intend to use to populate a table in an MSSQL database, but I'm getting an error when trying to connect to it. I'm using pypyodbc to achieve what I want.

My connection string looks like this:-

connection = pypyodbc.connect('Driver={SQL Server};' 'Server=mssql2008.aspnethosting.co.uk, 14330;' 'Database=not_telling_you;' 'uid=not_telling_you; pwd=not_telling_you')

The error I'm getting is:-

Traceback (most recent call last):
  File "/home/pi/Documents/Python/Competitions.py", line 7, in <module>
    import pypyodbc
  File "/usr/local/lib/python2.7/dist-packages/pypyodbc.py", line 439, in <module>
    raise OdbcNoLibrary('ODBC Library is not found. Is LD_LIBRARY_PATH set?')
OdbcNoLibrary: 'ODBC Library is not found. Is LD_LIBRARY_PATH set?'

I can't find anything online that tells me how to deal with this. I've literally followed the instructions from https://blogs.msdn.microsoft.com/cdndevs/2015/03/11/python-and-data-sql-server-as-a-data-source-for-python-applications/ and I don't really know what to do to fix. Hopefully you can help.

Mat Richardson
  • 3,576
  • 4
  • 31
  • 56

1 Answers1

0

I recently had similar trouble with a Foxpro database. The issue turned out to be a path issue, where I had to reset the python file working directory to that of the database file. You could be facing something similar, or you might be missing an ODBC driver. Have a look at this page.