Connection to MongoDB in the cloud

HelloùI havw a java progran and I want to connect to my mongo db
here the connection string I got from the site
String uri = “mongodb+srv://cipollan:xxxxxx%40xxxxxx%40@cluster0.53g76t2.mongodb.net/?retryWrites=true&w=majority”;
The folllowing fails
MongoClient mongoClient = MongoClients.create(uri);
How can I connect to my atlas mongo db?
Thanks

That URI is, I believe, incorrect. I suspect you copied or typed it wrong. There should not be those special characters in your password.

I have modified the connectionstring by removing any special characted but it doesn’t wark anyway.
Do you have a working example of a java program connecting to a mongodb database on atlas platform? Thanks

Did you get the URL for the connection exactly from what Atlas offers you in the connection page?

Also, if you’re having trouble connecting, I would suggest first you try connecting with mongosh and make sure everything works, and then try a language driver like Java.

Hi
I tried to connect with mongosh and I got the following error (I used the conneciton string got from the site)
Current Mongosh Log ID: 64268d897beeb0e40a749f48
Connecting to: mongodb+srv://@cluster0.53g76t2.mongodb.net/?retryWrites=true&w=majority&appName=mongosh+1.8.0
MongoServerSelectionError: connect ETIMEDOUT 63.33.255.135:27017
Press any key to exit:

Any Idea on what I should look for?
Thanks a lot

Maybe I should allow connections from my client IP? But How could I handle a conectione from a Mobile cient?

I have added in the network panel permission for connecting from any client but the error of connection timeout is still happening

It sounds like you are being blocked by a firewall. Are you in a corporate environment and behind a firewall?