0

I am suddenly getting the error message java.sql.SQLException: No suitable driver when I try to connect to my Azure SQL Server from my Databricks notebook. I have been successfully connecting without any issues for as long as I can remember. Therefore, I'm guessing that there is a worldwide platform issue with Apache Spark/Databricks, but not sure.

jdbcUrl = f"jdbc:sqlserver://{DBServer}.database.windows.net:1433;database={DBDatabase};user={DBUser};password={DBPword};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"  
df = spark.read.csv("/mnt/lake/RAW/cashsales_1.csv")  
df.write.mode("overwrite") \
     .format("jdbc") \
     .option("url", jdbcUrl) \
     .option("dbtable", 'UpdatedProducts')\
     .save()

If that is not the case, can someone let me know how to resolve this issue?

Thanks

Alex Ott
  • 80,552
  • 8
  • 87
  • 132
Patterson
  • 1,927
  • 1
  • 19
  • 56
  • show the code. SQL Server driver should be a part of DBR – Alex Ott Sep 02 '21 at 06:56
  • Morning @AlexOtt, it was a bit silly of me to not include the code. Here you go: ```jdbcUrl = f"jdbc:sqlserver://{DBServer}.database.windows.net:1433;database={DBDatabase};user={DBUser};password={DBPword};encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;" df = spark.read.csv("/mnt/lake/RAW/cashsales_1.csv") df.write.mode("overwrite") \ .format("jdbc") \ .option("url", jdbcUrl) \ .option("dbtable", 'UpdatedProducts')\ .save()``` – Patterson Sep 02 '21 at 07:44
  • Also, can you let me know if there is a way to paste my code in SE in a more legible way? – Patterson Sep 02 '21 at 07:45
  • just press "Edit" button on the post itself – Alex Ott Sep 02 '21 at 07:48
  • is it community edition or azure databricks? also - what version of DBR? – Alex Ott Sep 02 '21 at 07:49
  • Its a Community Edition, but I've never had this problem before – Patterson Sep 02 '21 at 07:50
  • I really desperately need this to work, as I'm still training and its cost too much to develop and train in Azure – Patterson Sep 02 '21 at 07:58
  • Oh, I just noticed you asked for the DBR. Its 8.3 (includes Apache Spark 3.1.1, Scala 2.12) – Patterson Sep 02 '21 at 08:09
  • have you checked this first step: https://learn.microsoft.com/en-us/azure/databricks/data/data-sources/sql-databases#step-1-check-that-the-jdbc-driver-is-available – Alex Ott Sep 02 '21 at 10:34
  • Hi @AlexOtt, while waiting for your response, I changed the DBR to 7.3 LTS (includes Apache Spark 3.0.1, Scala 2.12) and I was able to connect to the SQL Server. I will try implementing the solution you provided in the link – Patterson Sep 02 '21 at 13:12
  • it's interesting... I think that it should be escalated via support – Alex Ott Sep 02 '21 at 13:48
  • Hi @AlexOtt, is escalating the issue to support something that you can do (seeing as you're with Databricks? Or would I need to somehow get in touch with Databricks? – Patterson Sep 02 '21 at 14:40
  • if you on Azure, you can open Azure ticket. – Alex Ott Sep 02 '21 at 15:31
  • Hi @AlexOtt, once again, thanks for your help. I will open an Azure ticket – Patterson Sep 02 '21 at 19:05

0 Answers0