Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (0)
See original GitHub issueI developed a function which inserts data to Azure SQL Server when an excel file is uploaded to Azure storage container. Function works perfectly fine on local machine. After testing locally I deployed the function using below command:-
func azure functionapp publish ‘functionname’ --build-native-deps --additional-packages “python3-dev libevent-dev unixodbc-dev” --force --no-bundler
On Uploading file to storage account after deployment to Azure, I see below error in logs:-
Result: Failure Exception: Error: (‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 13 for SQL Server’ : file not found (0) (SQLDriverConnect)”) Stack: File “/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py”, line 288, in _handle__invocation_request self.__run_sync_func, invocation_id, fi.func, args) File “/root/.pyenv/versions/3.6.8/lib/python3.6/concurrent/futures/thread.py”, line 56, in run result = self.fn(*self.args, **self.kwargs) File “/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py”, line 347, in __run_sync_func return func(**params) File “/home/site/wwwroot/ProcessExcelApp1EU0304/init.py”, line 44, in main cnxn=pyodbc.connect(dbconnection)
Please provide the following:
- Timestamp:2019-03-05 19:05:57.735
- Function App name:ProcessExcelApp1EU0304
- Function name(s) (as appropriate):ProcessExcelApp1EU0304
- Core Tools version: Azure Functions Core Tools (2.4.317 Commit hash:63e1996b6c281079427e7c9b8a0a1c633988a195) Function Runtime Version: 2.0.12285.0
Repro steps
Provide the steps required to reproduce the problem:
- Upload a file to storage account container configured to trigger the function from
- Data should get inserted to Azure SQL Server DB url for which is setup in application settings
Expected behavior
Function should read the excel file and then data should get inserted to Azure SQL Server DB url for which is setup in application settings
Actual behavior
Result: Failure Exception: Error: (‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 13 for SQL Server’ : file not found (0) (SQLDriverConnect)”) Stack: File “/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py”, line 288, in _handle__invocation_request self.__run_sync_func, invocation_id, fi.func, args) File “/root/.pyenv/versions/3.6.8/lib/python3.6/concurrent/futures/thread.py”, line 56, in run result = self.fn(*self.args, **self.kwargs) File “/root/.pyenv/versions/3.6.8/lib/python3.6/site-packages/azure/functions_worker/dispatcher.py”, line 347, in __run_sync_func return func(**params) File “/home/site/wwwroot/ProcessExcelApp1EU0304/init.py”, line 44, in main cnxn=pyodbc.connect(dbconnection)
Known workarounds
Have to run it locally for testing
Related information
Provide any related information
- Links to source
- Contents of the requirements.txt file
- Bindings used
Issue Analytics
- State:
- Created 5 years ago
- Comments:20 (2 by maintainers)
Top GitHub Comments
I am using Windows 10 machine to develop locally and deployed after testing locally.
Found a work around today afternoon. If I replace {ODBC Driver 13 for SQL Server} to {ODBC Driver 17 for SQL Server} in connection string then it is working fine. But I am not really sure if this is the right way to do it because Azure SQL DB connection string has {ODBC Driver 13 for SQL Server} in connection string.
This is fixed in the latest release (
2.6.1048
<=) ofazure-functions-core-tools
. https://github.com/Azure/azure-functions-core-tools/issues/1211 for more information.