Data insert failing to SQLMI from Databricks runtime 9.1LTS

AHMAD Muhammad 21 Reputation points
2022-04-05T06:09:32.423+00:00

Hi,

I am inserting data into sqlserver table using a bulk copy per the below code.
%scala
import com.microsoft.azure.sqldb.spark.bulkcopy.BulkCopyMetadata
import com.microsoft.azure.sqldb.spark.config.Config
import com.microsoft.azure.sqldb.spark.connect._

val Datawriter = spark.sql("select * from testtable")  
  
val bulkCopyConfig = Config(Map(  
                              "url"             -> jdbcHost,  
                              "databaseName"    -> jdbcDatabase,  
                              "user"            -> jdbcUsername,  
                              "password" -> jdbcPassword,  
                              "dbTable" -> jdbcTableName,  
                              "bulkCopyBatchSize" -> "2000",  
                              "bulkCopyTablelock" -> "true",  
                              "bulkCopyTimeout" -> "6000"))  
  
Datawriter.bulkCopyToSqlDB(bulkCopyConfig)  

the above is throwing error as below
NoSuchMethodError: com.microsoft.sqlserver.jdbc.SQLServerBulkCopy.writeToServer(Lcom/microsoft/sqlserver/jdbc/ISQLServerBulkRecord;)V

as per google and other forums i need to install mssql-jdbc library, but there are a number of versions of that library and i am unable to figure out which one is relevant to the cluster configuration.
I have tried installing quite a few of : com.microsoft.sqlserver:mssql-jdbc:

the cluster configuration is in the attached screenshot.
189997-sql-error-cluster-config-2.png

my scala code with error is also attached in the screenshot190006-sqlconnectorerror.png

can someone please help with this.

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

2 answers

Sort by: Most helpful
  1. AHMAD Muhammad 21 Reputation points
    2022-04-07T23:31:42.04+00:00

    @PRADEEPCHEEKATLA I dont have access to support plan. Can you please lodge a ticket with a high priority.
    Thanks

    0 comments No comments

  2. Eveline M. Guimarães 1 Reputation point
    2022-08-31T21:49:34.093+00:00

    @AHMAD Muhammad , hi I got the same errors as you. Did you find any solution to this?
    Thanks in advance

    0 comments No comments

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.