This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Description
Hi,
Getting following error while writing df to sql server -
org.apache.spark.SparkException: Job aborted due to stage failure: Task 27 in stage 3.0 failed 4 times, most recent failure: Lost task 27.3 in stage 3.0 (TID 202) (10.40.64.38 executor 0): com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Code -
url = server_name + ":1433;" + "databaseName=" + database_name + ";"
df.write
.format("com.microsoft.sqlserver.jdbc.spark")
.mode("overwrite")
.option("driver", "com.microsoft.sqlserver.jdbc.SQLServerDriver")
.option("url", url)
.option("dbtable", table_name)
.option("user", username)
.option("password", password)
.save()