My web app communicates with a SQL database hosted on Azure. To communicate and read/write data to it, I use the library pyodbc. Unfortunately, I am getting errors on render that say I don’t have the ODBC drivers for it.
Nov 23 04:04:23 PM File "/opt/render/project/src/.venv/lib/python3.7/site-packages/scrapy/utils/misc.py", line 172, in create_instance
Nov 23 04:04:23 PM instance = objcls(*args, **kwargs)
Nov 23 04:04:23 PM File "/opt/render/project/src/app/part_scraper/pipelines.py", line 26, in __init__
Nov 23 04:04:23 PM with pyodbc.connect(self.connection_string) as conn:
Nov 23 04:04:23 PM pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
Is there any way I can install the ODBC drivers or is not possible right now?
The problem was that I was not able to install ODBC drivers globally on Render so I solved it by building my app using a Dockerfile, in which I put the commands to install the drivers.
I’ve been trying to deploy a simple flask api connected to a client’s MSSQL database. I was running into the same issue with pyodbc. After creating a docker container and installing ODBC Driver 17 the following error appears when trying to make a request: