<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Connection to Azure SQL Server: ODBC Driver 18 for SQL Server in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3307#M389</link>
    <description>&lt;P&gt;&lt;B&gt;Task&lt;/B&gt;: &lt;/P&gt;&lt;P&gt;Setup connection to Azure SQL Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple things have changed...&lt;/P&gt;&lt;P&gt;*We've started using Unity Catalog, so need Unity Catalog -enabled clusters&lt;/P&gt;&lt;P&gt;*Legacy init scripts have been deprecated, and this is how we had our pyodbc setup, etc. defined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Code&lt;/B&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;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
&amp;nbsp;
def execute_azsql_query(sqlquery):
  conn = build_odbc_connection(sec_SourceServer, sec_SourceDatabase,sec_SinkAzSqlAppID,sec_SinkAzSqlSecret)
  df = pd.read_sql(sqlquery,conn)
  conn.close()
  return df
&amp;nbsp;
execute_azsql_query('select * from dbo.client')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 18 for SQL Server' : file not found (0) (SQLDriverConnect)")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I missing here?  Thanks!&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 21:18:55 GMT</pubDate>
    <dc:creator>js54123875</dc:creator>
    <dc:date>2023-06-09T21:18:55Z</dc:date>
    <item>
      <title>Connection to Azure SQL Server: ODBC Driver 18 for SQL Server</title>
      <link>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3307#M389</link>
      <description>&lt;P&gt;&lt;B&gt;Task&lt;/B&gt;: &lt;/P&gt;&lt;P&gt;Setup connection to Azure SQL Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A couple things have changed...&lt;/P&gt;&lt;P&gt;*We've started using Unity Catalog, so need Unity Catalog -enabled clusters&lt;/P&gt;&lt;P&gt;*Legacy init scripts have been deprecated, and this is how we had our pyodbc setup, etc. defined.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;B&gt;Code&lt;/B&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;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
&amp;nbsp;
def execute_azsql_query(sqlquery):
  conn = build_odbc_connection(sec_SourceServer, sec_SourceDatabase,sec_SinkAzSqlAppID,sec_SinkAzSqlSecret)
  df = pd.read_sql(sqlquery,conn)
  conn.close()
  return df
&amp;nbsp;
execute_azsql_query('select * from dbo.client')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 18 for SQL Server' : file not found (0) (SQLDriverConnect)")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What am I missing here?  Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 21:18:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3307#M389</guid>
      <dc:creator>js54123875</dc:creator>
      <dc:date>2023-06-09T21:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to Azure SQL Server: ODBC Driver 18 for SQL Server</title>
      <link>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3309#M391</link>
      <description>&lt;P&gt;Hi @Jennette Shepard​&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope everything is going great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 07:20:56 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3309#M391</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-16T07:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to Azure SQL Server: ODBC Driver 18 for SQL Server</title>
      <link>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3310#M392</link>
      <description>&lt;P&gt;Thanks for checking in.  Yes the driver is not installed, but I'm not sure the current correct way to install&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 18:00:17 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/3310#M392</guid>
      <dc:creator>js54123875</dc:creator>
      <dc:date>2023-06-16T18:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to Azure SQL Server: ODBC Driver 18 for SQL Server</title>
      <link>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/49005#M28446</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/72142"&gt;@js54123875&lt;/a&gt;&amp;nbsp;did you manage to find a solution for this? I'm facing a similar problem.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Diego&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 07:21:54 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/49005#M28446</guid>
      <dc:creator>diego_poggioli</dc:creator>
      <dc:date>2023-10-12T07:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Connection to Azure SQL Server: ODBC Driver 18 for SQL Server</title>
      <link>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/49151#M28488</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/83562"&gt;@Jodie&lt;/a&gt;&amp;nbsp;- We're using this jdbc driver to connect&amp;nbsp;&lt;A href="https://docs.databricks.com/en/external-data/sql-server.html" target="_blank"&gt;Query SQL Server with Databricks | Databricks on AWS&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Oct 2023 19:10:47 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/connection-to-azure-sql-server-odbc-driver-18-for-sql-server/m-p/49151#M28488</guid>
      <dc:creator>js54123875</dc:creator>
      <dc:date>2023-10-13T19:10:47Z</dc:date>
    </item>
  </channel>
</rss>

