This string includes the options used to connect to a Microsoft Azure Cosmos DB for MongoDB. Connection strings for Azure Cosmos DB for MongoDB are similar to standard MongoDB connections, but require TLS encryption and authentication to be enabled.
Note: The strings demonstrated in this section use the DSN-less format. For additional formats, see "Using a connection string."

This string includes the options used to connect through a proxy server with authentication.

DRIVER=DataDirect 8.1 MongoDB;DatabaseName=database;EncryptionMethod=1;
  HostName=hostname;PortNumber=port;ValidateServerCertificate=0;User=user_name;
  Password=password;[attribute=value[;...]];

where:

database
(optional) specifies the name of the database to which you want to connect. This value is used as the default qualifier for unqualified table names in SQL queries.
Note: This value is case-insensitive if you have access privileges to query the list of databases on the server. If you do not have access, this value is case-sensitive.
hostname
specifies the name or the IP address of the Azure Cosmos DB for MongoDB server to which you want to connect. For example, myCosmosdbServer.
port

specifies the port number of the server listener. This value is typically 10255 for Azure Cosmos DB for MongoDB connections.

user_name
(optional) specifies the your Azure Cosmos DB account name. For example, jsmith.
password
(optional) specifies the password used to connect to your Azure Cosmos DB account.
attribute=value
specifies connection option settings. Multiple option attributes are separated by a semi-colon.
Note: The User and Password options are not required to be stored in the connection string. They can also be sent separately by the application using the SQLConnect ODBC API. For SQLDriverConnect and SQLBrowseConnect, they will need to be specified in the connection string.

The following example connection string includes the basic properties used for connecting to a Azure Cosmos DB database.

DRIVER=DataDirect 8.1 MongoDB;DatabaseName=mydb;EncryptionMethod=1;
       HostName=myCosmosdbServer;PortNumber=10255;ValidateServerCertificate=0;
       User=jsmith;Password=secret;