<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Mongo Db connector - Connection timeout when trying to connect to AWS Document DB in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143782#M52226</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/193092"&gt;@bianca_unifeye&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I was able to solve this issue by adding a JVM truststore. But it involved modifying the default Java cacert and appending the custom cert to the default cacert. I followed this KB article for &lt;A href="https://kb.databricks.com/python/import-custom-ca-cert" target="_blank"&gt;How to import a custom CA certificate - Databricks.&lt;/A&gt;&amp;nbsp;Thanks for the response!&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jan 2026 16:51:58 GMT</pubDate>
    <dc:creator>rijin-thomas</dc:creator>
    <dc:date>2026-01-12T16:51:58Z</dc:date>
    <item>
      <title>Mongo Db connector - Connection timeout when trying to connect to AWS Document DB</title>
      <link>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/141554#M51756</link>
      <description>&lt;P&gt;I am on Databricks Run Time LTE 14.3 Spark 3.5.0 Scala 2.12 and mongodb-spark-connector_2.12:10.2.0.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Trying to connect to Document DB using the connector and all I get is a connection timeout. I tried using PyMongo, which works as expected and I can read from the db. I have a CA_File that I'm passing as an argument and it's stored in Unity Catalog.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;CONNECTION_URI = f"mongodb://{USERNAME}:{PASSWORD}@{ENDPOINT}:27017/{DATABASE_NAME}?replicaSet=rs0&amp;amp;readPreference=secondaryPreferred"

df = spark.read.format("mongodb") \
     .option("spark.mongodb.read.connection.uri", CONNECTION_URI) \
     .option("collection", COLLECTION) \
     .option("ssl", "true") \
     .option("ssl.CAFile", DBFS_CA_FILE) \
     .option("ssl.enabledProtocols", "TLSv1.2") \
     .load()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Connector error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;SparkConnectGrpcException: (com.mongodb.MongoTimeoutException) Timed out after 30000 ms while waiting for a server that matches com.mongodb.client.internal.MongoClientDelegate. Client view of state is {type=REPLICA_SET, servers=[{address=&amp;lt;endpoint&amp;gt;, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message}, caused by {java.net.SocketTimeoutException: Read timed out}}]&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Dec 2025 03:20:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/141554#M51756</guid>
      <dc:creator>rijin-thomas</dc:creator>
      <dc:date>2025-12-10T03:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Mongo Db connector - Connection timeout when trying to connect to AWS Document DB</title>
      <link>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143365#M52161</link>
      <description>&lt;P&gt;If PyMongo works but the Spark connector times out, the issue is almost always &lt;STRONG&gt;JVM TLS configuration or executor-level network access&lt;/STRONG&gt;, not credentials or the database itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;TLS handling (most common cause):&lt;/STRONG&gt;&lt;BR /&gt;The MongoDB Spark connector runs on the JVM and does &lt;STRONG&gt;not handle CA PEM files the same way as PyMongo&lt;/STRONG&gt;. Use a &lt;STRONG&gt;JVM truststore (JKS or PKCS12)&lt;/STRONG&gt; instead of ssl.CAFile, and configure it via JVM options for &lt;STRONG&gt;both driver and executors&lt;/STRONG&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Executor connectivity:&lt;/STRONG&gt;&lt;BR /&gt;PyMongo usually tests connectivity from the &lt;STRONG&gt;driver only&lt;/STRONG&gt;. Spark reads from &lt;STRONG&gt;executors&lt;/STRONG&gt;, so confirm that all worker nodes can reach the DocumentDB endpoint on port &lt;STRONG&gt;27017&lt;/STRONG&gt; (security groups, routes, DNS).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Enable TLS via URI:&lt;/STRONG&gt;&lt;BR /&gt;Set TLS explicitly in the connection string (e.g. tls=true) rather than relying on connector options.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;DocumentDB compatibility:&lt;/STRONG&gt;&lt;BR /&gt;Add retryWrites=false to the connection string to align with Amazon DocumentDB limitations.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jan 2026 14:52:01 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143365#M52161</guid>
      <dc:creator>bianca_unifeye</dc:creator>
      <dc:date>2026-01-08T14:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: Mongo Db connector - Connection timeout when trying to connect to AWS Document DB</title>
      <link>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143412#M52172</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/200230"&gt;@rijin-thomas&lt;/a&gt;&amp;nbsp;- Can you please allow the CIDR block for databricks account VPC from aws document db sg (&amp;nbsp;Executor connectivity stated by&lt;STRONG&gt;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/193092"&gt;@bianca_unifeye&lt;/a&gt;&amp;nbsp;) .&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jan 2026 05:06:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143412#M52172</guid>
      <dc:creator>Sanjeeb2024</dc:creator>
      <dc:date>2026-01-09T05:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: Mongo Db connector - Connection timeout when trying to connect to AWS Document DB</title>
      <link>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143782#M52226</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/193092"&gt;@bianca_unifeye&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I was able to solve this issue by adding a JVM truststore. But it involved modifying the default Java cacert and appending the custom cert to the default cacert. I followed this KB article for &lt;A href="https://kb.databricks.com/python/import-custom-ca-cert" target="_blank"&gt;How to import a custom CA certificate - Databricks.&lt;/A&gt;&amp;nbsp;Thanks for the response!&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jan 2026 16:51:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143782#M52226</guid>
      <dc:creator>rijin-thomas</dc:creator>
      <dc:date>2026-01-12T16:51:58Z</dc:date>
    </item>
    <item>
      <title>Re: Mongo Db connector - Connection timeout when trying to connect to AWS Document DB</title>
      <link>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143881#M52232</link>
      <description>&lt;P&gt;Glad I was able to help!&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jan 2026 11:54:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/mongo-db-connector-connection-timeout-when-trying-to-connect-to/m-p/143881#M52232</guid>
      <dc:creator>bianca_unifeye</dc:creator>
      <dc:date>2026-01-13T11:54:22Z</dc:date>
    </item>
  </channel>
</rss>

