install msodbcsql1 in databricks

Abhishek Gaikwad 191 Reputation points
2021-09-24T18:47:15.92+00:00

I want to use databricks to run storedprocedure on Azure SQL database in PAAS. I have got the pyodbc library install on the databricks cluster. I am getting error ODB Driver 17 for SQL server : file not found.
when i run the below code to install the odbc driver I get the below error message .

%sh
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get -q -y install msodbcsql17

Error Message :

Failed writing body
/bin/bash: line 1: /etc/apt/sources.list.d/mssql-release.list: Permission denied

Will the odbc driver wont be installed along with the pyodbc library.
Is their any other approach to install msodbcsql17

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,059 questions
{count} vote

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA-MSFT 84,941 Reputation points Microsoft Employee
    2021-09-27T04:22:54.63+00:00

    Hello @Abhishek Gaikwad ,

    Thanks for the question and using MS Q&A platform.

    As per the repro, by using the same code - I'm able to install the msodbcsql7 without any issues on Azure Databricks Runtime 9.0:

    135368-image.png

    Based on the Databricks Runtime, this could be a problem when you use sudo in this fashion, it won't work right. I would request you to try this command and see if it works.

     %sh  
     curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -  
     curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list   
     apt-get update  
     ACCEPT_EULA=Y apt-get install msodbcsql17  
    

    135415-image.png

    For more details, refer to this question which addressing similar issue.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators