Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
Showing results for 
Search instead for 
Did you mean: 

Connection to Azure SQL Server: ODBC Driver 18 for SQL Server

New Contributor III


Setup connection to Azure SQL Server.

A couple things have changed...

*We've started using Unity Catalog, so need Unity Catalog -enabled clusters

*Legacy init scripts have been deprecated, and this is how we had our pyodbc setup, etc. defined.


import pyodbc
def build_odbc_connection(dbserver, dbname, username, pwd):
  conn = pyodbc.connect('DRIVER={ODBC Driver 18 for SQL Server};SERVER='+dbserver+';DATABASE='+dbname+';ENCRYPT=yes;UID='+username+';PWD='+ pwd)
  return conn
def execute_azsql_query(sqlquery):
  conn = build_odbc_connection(sec_SourceServer, sec_SourceDatabase,sec_SinkAzSqlAppID,sec_SinkAzSqlSecret)
  df = pd.read_sql(sqlquery,conn)
  return df
execute_azsql_query('select * from dbo.client')


('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 18 for SQL Server' : file not found (0) (SQLDriverConnect)")

What am I missing here? Thanks!


Community Manager
Community Manager

Hi @Jennette Shepard​, The error message you provided indicates that the ODBC driver named ’ODBC Driver 18 for SQL Server is not found or cannot be opened. This error commonly occurs when the required driver files are missing or the driver is not installed correctly.

Not applicable

Hi @Jennette Shepard​ 

Hope everything is going great.

Just wanted to check in if you were able to resolve your issue. If yes, would you be happy to mark an answer as best so that other members can find the solution more quickly? If not, please tell us so we can help you. 


New Contributor III

Thanks for checking in. Yes the driver is not installed, but I'm not sure the current correct way to install


Hi @js54123875 did you manage to find a solution for this? I'm facing a similar problem.



Hi @Jodie - We're using this jdbc driver to connect Query SQL Server with Databricks | Databricks on AWS

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!