mongodb / mongo-jdbc-driver

JDBC Driver for MongoDB Atlas SQL interface
Apache License 2.0
35 stars 33 forks source link

Getting timeout from MongoDB Atlas #124

Closed felipe-casali closed 9 months ago

felipe-casali commented 1 year ago

I'm trying to use this string to connect into a MongoDB Atlas, but it's failing with timeout. Is there something I missed on the string structure?

jdbc:mongodb://user:password@clustermongodb.xqslipn.mongodb.net/myFirstDatabase

I realized that the clustermongodb.xqslipn.mongodb.net is not resolving with nslookup, but I'm not sure if it's the problem because I was able to connect from the same host using the mongosh.

jchemburkar commented 9 months ago

Hi @felipe-casali , one thing to address your issue would be to set a timeout in the connection string. For example, to your above url, you could append ?connectTimeoutMS=<milliseconds>. Similarly, socket timeout can be set as well. More information on what options can be set in the connection string can be found here!