Dear Giles,
I followed the instructions linked below to the T, but I still can't get around this error I'm getting. I also tried various different UID combinations such as yourusername@yourservername. All 3 files ( .freetds.conf, odbc.ini, odbcinst.ini) have been placed in my project directory. Please assist. Thank you
Instructions followed: https://help.pythonanywhere.com/pages/MSSQLServer/
Error:
pyodbc.OperationalError: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
MY CODE:
os.environ["ODBCSYSINI"] = "/home/MY_PYTHONANYWHERE_USERNAME/MY_PROJECT DIRECTORY"
self.cnt = pyodbc.connect('DSN=sqlserverdatasource;Uid=MY_USER_ID;Pwd=MY_PASSWORD;Encrypt=yes;Connection Timeout=30;')
.freetds.conf
[sqlserver]
host = MY_SERVER_ IP (values replaced by my server IP)
port = MY_PORT (values replaced by my server port)
tds version = 7.0
odbc.ini
[sqlserverdatasource]
Driver = FreeTDS
Description = ODBC connection via FreeTDS
Trace = No
Servername = sqlserver
odbcinst.ini
[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
CPTimeout =
CPReuse =
FileUsage = 1