3

I am trying to connect Mongodb Atlas cluster to Studio 3t.

I copied mongodb+srv://:@cluster0-ohzuo.mongodb.net/test from Mongodb account in "connect to cluster"

In Studio 3t,I went to connection manager > new connection > Import URI and pasted the above string.

I am getting the following error : Failed to import the URI. Unable to look up TXT record for host cluster0-ohzuo.mongodb.net

2 Answers2

4

I solved the problem by changing the Java version in the connection method from "3.7 or later" to "3.4 or later":

Open connect

Select 3.4 or later java version

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
1

For someone else in future having similar issue

Yes to overcome this, you have to add a DNS route

System.setProperty("java.naming.provider.url", "dns://8.8.8.8");

Like this: https://github.com/mongodb-developer/starter-azure-function-mongodb/blob/c8c8a1f52d145450349a9a710eb3825237c7c3f0/src/main/java/org/mongodb/functions/Movies.java#L37

Also, mentioned in this article: https://www.mongodb.com/developer/products/atlas/azure-functions-mongodb-atlas-java/#connecting-the-serverless-function-with-mongodb-atlas

Code_Life
  • 5,742
  • 4
  • 29
  • 49
  • 2
    Please provide enough details to make this answer self-sufficient. While the links are welcome, the body of the answer should be enough to understand what to do to solve the issue. Also please don't duplicate this "answer" on many questions. – mozway Apr 14 '23 at 11:59
  • @mozway: Sorry, I missed an important part to add. – Code_Life Apr 14 '23 at 15:12
  • This, or a variation of this, fixed my issue. I actually added the url system property to the eclipse run configuration. I asked a similar question at the link below. The question I have is why did it all of a sudden start happening? Could certbot have reocnfigured something? https://stackoverflow.com/questions/76774020/mongodb-failed-looking-up-txt-record-for-host – broadbear Jul 26 '23 at 18:59