Access Azure SQL DB through AD from data bricks

Aswini Dindukurthy 6 Reputation points
2021-07-15T19:35:06.157+00:00

Hello,

I have installed com.microsoft.azure:azure-sqldb-spark:1.0.2 and using data bricks run time 6.4 Extended Support (includes Apache Spark 2.4.5, Scala 2.11).

Below is the code:
%python
jdbc_df = spark.read.format("com.microsoft.sqlserver.jdbc.spark").option("url", "hostname here:1433") .option("dbtable", "dbo._Temp_001").option("authentication", "ActiveDirectoryPassword").option("user","test@test .com").option("password", "password here").option("encrypt", "true").option("hostNameInCertificate", "*.database.windows.net").load()

receiving below error:

java.lang.ClassNotFoundException: Failed to find data source: com.microsoft.sqlserver.jdbc.spark. Please find packages at http://spark.apache.org/third-party-projects.html

Please help me

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
{count} votes

1 answer

Sort by: Most helpful
  1. PRADEEPCHEEKATLA 91,576 Reputation points Moderator
    2021-07-16T08:05:26.54+00:00

    Hello @Aswini Dindukurthy ,

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

    You are experiencing this error message due to extra space between .option("url", "hostname here:1433") and .option("dbtable", "dbo._Temp_001").

    Note: Try to remove the space to resolve the issue.

    ![115230-image.png

    For more details, refer to the below links:

    Apache Spark connector: SQL Server & Azure SQL

    Notebook - SQL Spark Connector - Python AAD Auth

    Hope this helps. Do let us know if you any further queries.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.