2 / 2
Jul 2024

I’m learnign the mongodb, as part of my learning using the java starter application , i’m trying to running the application in Intellij after creating linking the cluster using mongodb connection string. While runnning the application i’m getting DNS error, but i tried DSN server checks using cmd all working normal and fine.

There is no spelling mistake or password mistake in my connection string.

Can any one please help me on this.

Hi @Subramaniyan_Krishnaraj1 and welcome to the community forum.

You might want to check a few things for making the connection successful:

  1. Does your username and password contains any special characters? If yes, you might have to change the password in that case and try again.
  2. Are you able to connect with the connection outside of the Java application? Using Compass or Shell? If yes, can you share the code snippet or the example on how you are trying to make the connection?
  3. Have you allowed “Allow access from anywhere” in your Atlas cluster while performing the network setting?
  4. Also verify the Java version that you are using for getting the connection string.

If the issue persists, could you please help me with the exact error message that you are seeing while making the connection.

Regards
Aasawari