Hey,
Here the solution: The correct option for ssl is "useSSL" and not just "ssl".
This code below could works:
df_target_master = spark.read.format("jdbc")\
.option("driver", "com.mysql.jdbc.Driver")\
.option("url", host_url)\
.option("dbtable", supply_master)\
.option("user", user_id)\
.option("password", pwd)\
.option("useSSL", True) \
.option("sslmode", "verify-ca" ) \
.option("sslrootcert", "<s3 bucket location") \
.load()
I'm able to access a mySQL with "Enforce SSL Connection" Enabled in Azure with only this change.
In Databricks Runtime 11.2 and above you can use the MySQL connector in Databricks Runtime. The code could be like this:
remote_table = (spark.read
.format("mysql")
.option("dbtable", table)
.option("host", database_host_url)
.option("port", 3306)
.option("database", database_name)
.option("user", uid)
.option("password", pwd)
.option("useSSL", True)
.option("sslmode", "verify-ca" )
.load()
)