Connection String for Azure Cosmos DB API for Mongo DB

We are tyring to create a data source in Stardog Studio to connect to our Azure Cosmos DB with MongoDB API using MongoDB driver provided by Stardog. But getting Read time out error. Following exception is logged in log file:

WARN 2021-11-02 14:07:46,946 [stardog-user-69] com.complexible.stardog.protocols.http.server.StardogUndertowErrorHandler:accept(68): Unexpected exception was handled by the server
com.mongodb.MongoTimeoutException: Timed out after 30000 ms while waiting to connect. Client view of cluster state is {type=UNKNOWN, servers=[{, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketReadTimeoutException: Timeout while receiving message}, caused by { Read timed out}}]

We are using following uri to connect : mongodb://
also setting the username and password as jdbc.username and jdbc.password variables.

We also tried to connect using following uri, but getting same error

So would like to know what should be the connection string for Azure Cosmos DB API for Mongo DB and how to specify the port as the port is 10255.


Using connection string in following format solved our issue:
mongodb: //username:password@host:port/database?ssl=true


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.