3 weeks ago
Hello, I'm having this issue with job-computes:
The snippet of the code is as follows:
84 if self.conf["persist_to_sql"]:
85 # persist to sql
86 df_parsed.write.format(
87 "com.microsoft.sqlserver.jdbc.spark"
88 ).option("url", self.get_sql_connection_string()).option(
89 "dbtable", self.conf["sql_tables"]["report"]
90 ).option(
91 "driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver"
92 ).mode(
93 "append"
---> 94 ).save()
95 self.logger.info(
96 f"Saved to {self.conf['sql_tables']['report']}"
97 )
How can I install the driver to this job-compute?
This is the driver I'm want to install: spark-mssql-connector_2.12-1.4.0-BETA.jar
I tried:
Thanks
2 weeks ago
Up!
2 weeks ago
To install the spark-mssql-connector_2.12-1.4.0-BETA.jar driver for Azure Databricks job clusters, use one of these methods:
Add these Maven coordinates to your cluster/library configuration:
Steps:
Navigate to your Databricks cluster settings.
Under Libraries, select Install New → Maven.
Paste the coordinates above and install
For job clusters, specify libraries directly in the job settings:
This ensures dependencies are included when the job cluster starts
If using an init script, ensure both the connector and JDBC driver are copied:
Upload the JARs to DBFS first
Spark Version Compatibility: Confirm your Databricks runtime aligns with the connector’s Spark 3.4 requirement
JDBC Dependency: The mssql-jdbc driver is mandatory to resolve NoClassDefFoundError
Avoid Manual DBFS Uploads: Maven installation is preferred for dependency management
For Azure Data Factory pipelines, configure the libraries in the Databricks linked service’s Advanced settings under "Libraries"
2 weeks ago - last edited 2 weeks ago
For a job compute, you would have to go init script route.
Can you please highlight, the cause of the failure of library installation via init script?
a week ago - last edited a week ago
Hello @NandiniN ,
In the Shared folder I created a init_script for the JobCompute defined as its shown:
#!/bin/bash
echo "=====> Installing MSSQL Spark Connector"
cp /dbfs/Workspace/Shared/drivers/spark-mssql-connector_2.12-1.4.0-BETA.jar /databricks/jars/
echo "=====> Connector copied!"
In the logs there isn't any log and the workflow is still failing due to the missing driver, if you could give me any direction for trying to solve this would be much appreciated
a week ago
Up!
Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!
Sign Up Now