question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (0)

See original GitHub issue

I 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:

  1. Upload a file to storage account container configured to trigger the function from
  2. 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:closed
  • Created 5 years ago
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
mdudiscommented, Mar 8, 2019

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.

1reaction
ankitkumarrcommented, May 1, 2019

This is fixed in the latest release (2.6.1048 <=) of azure-functions-core-tools . https://github.com/Azure/azure-functions-core-tools/issues/1211 for more information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking ...
Running: odbcinst -j. It yielded: unixODBC 2.3.4 DRIVERS............: /etc/odbcinst.ini SYSTEM DATA SOURCES: /etc/odbc.ini FILE DATA SOURCES ...
Read more >
('01000', "[01000] [unixODBC][Driver Manager]Can't open lib ...
Observerd behaviour: No connection to the DB because it can not locate ODBC Driver 17 for SQL. ... 3- When I try pyodbc.drivers()...
Read more >
Can't open lib 'ODBC Driver 13 for SQL Server'? Sym linking ...
PYTHON : Can't open lib ' ODBC Driver 13 for SQL Server '? Sym linking issue? [ Gift : Animated Search Engine ...
Read more >
Connecting to SQL from Centos, "Can't open lib 'ODBC Driver ...
We're connecting to SQL Server running on Windows server 2008, from a CentOS 7 VM using Python. We've been running around in circles...
Read more >
Azure RHEL 8 VM. pyodbc or django can't connect to SQL ...
I'm on an Azure RHEL 8 VM trying to connect to an Azure SQL Server using pyodbc and django, but got a "Can't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found