Unable to connect mongo with Databricks
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2024 10:43 PM
Hello,
I am trying to connect mongo with Databricks. I also used SSL certificate.
I created my own cluster and installed maven library org.mongodb.spark:mongo-spark-connector_2.12:3.0.1.
This is my code:
connection_string =f"mongodb://{secret['user']}:{secret['password']}@{secret['host']}:{secret['port']}/?authSource={secret['database']}&tls=true&tlsCAFile=temp/CA-certificate.pem"
df = spark.read.format("com.mongodb.spark.sql.DefaultSource")\
.option("database", database)\
.option("collection", collection)\
.option("spark.mongodb.input.uri", connectionString)\
.option("ssl", "true")\
.option("sslCertificate", sslCertificateFilePath)\
.load()
When I am running above code getting below error:
Please provide me solution for this.
Thanks