1

I installed Mongodb version 6.0.3 but its not able to connect with Studio 3T and getting below error.

Connection failed.

SERVER [172.30.53.203:27017] (Type: UNKNOWN)

\_/ Connection error (MongoSocketOpenException): Exception opening socket

|____/ Socket error: Connection refused: connect

Details:

Timed out after 5000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{address=172.30.53.203:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused: connect}}]

James Z
  • 12,209
  • 10
  • 24
  • 44
  • Did you start the MongoDB? Can you connect with `mongosh`? – Wernfried Domscheit Jan 22 '23 at 19:20
  • Yes, MongoDB is running and I am able to connect with mongosh but not connecting with Studio 3T – Pradip Kumar Jan 23 '23 at 05:15
  • What is the connection string in mongosh compared to connection string in Studio 3T? – Wernfried Domscheit Jan 23 '23 at 06:07
  • I am connection with IP address, user, password & admin database. – Pradip Kumar Jan 23 '23 at 06:18
  • In Studio 3T connection dialog you can export the connection string, compare this with the connection string you use with mongosh. There must be a relevant difference (if you are not willing to provide them here). – Wernfried Domscheit Jan 23 '23 at 06:39
  • Yes, difference is there as below, then what to do? --in studio 3T mongodb://myuser@172.30.53.103:27017/?serverSelectionTimeoutMS=5000&connectTimeoutMS=10000&authSource=admin&authMechanism=SCRAM-SHA-1&3t.uriVersion=3&3t.connection.name=172.30.53.203&3t.alwaysShowAuthDB=true&3t.alwaysShowDBFromUserRole=true --in mongosh mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2 – Pradip Kumar Jan 23 '23 at 08:12
  • 2
    Please edit your question for such information instead of adding it as comment. – Wernfried Domscheit Jan 23 '23 at 08:18
  • `mongodb://myuser@172.30.53.103:27017/?...` versus `mongodb://127.0.0.1:27017/?...` You connect to different machines! (unless your IP is 172.30.53.103 which I doubt, because it is a public IP) In Studio 3T you use username+password, in `mongosh` you don't use user credentials (at least not in the connection string). How can you say, "it is working with mongosh but not working in Studio 3T"? – Wernfried Domscheit Jan 23 '23 at 08:21
  • tried with this connection string then also not working mongodb://myuser:mypass@123@72.30.53.103:27017/?directConnection=true&serverSelectionTimeoutMS=2000&appName=mongosh+1.6.2 – Pradip Kumar Jan 23 '23 at 10:49
  • If the username or password includes the following characters `: / ? # [ ] @` then those characters must be converted using percent encoding. – Wernfried Domscheit Jan 23 '23 at 13:56

0 Answers0