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

jdbc:datadirect:mongodb://host:port;AuthenticationDatabase=auth_db;
DatabaseName=database;ProxyHost=proxy_host;ProxyPassword=proxy_password;
ProxyPort=proxy_port;ProxyUser=proxy_user;User=username;Password=password;
[property=value[;...]];

where:

host

specifies the name or the IP address of the MongoDB server to which you want to connect. For example, myserver.

port

specifies the port number of the server listener. The default is 27017.

auth_db

(recommended) specifies the database in which your user ID was created. This value allows you to explicitly select a set of credentials and permissions when the same user ID was created in multiple databases on the server.

Note: We recommend specifying a value for this option when using user ID and password authentication (AuthenticationMethod=userIdPassword) to ensure that the correct permissions are used for your connection.
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.
Important: 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.
proxy_host
specifies the proxy server to use for the first connection.
proxy_password
specifies the password needed to connect to a proxy server for the first connection.
proxy_port
specifies the port number where the proxy server is listening for requests for the first connection. The default is 0.
proxy_user
specifies the user name needed to connect to a proxy server for the first connection.
user
specifies the user name that is used to connect to the MongoDB database. For example, jsmith.
password
specifies the password used to connect to your MongoDB database.
property=value
specifies connection property settings. Multiple properties are separated by a semi-colon.
Note: The User and Password properties are not required to be stored in the connection string. They can also be passed separately by the application.

The following example connection string includes the properties required for using a proxy server with user ID and password authentication.

Connection conn = DriverManager.getConnection
  ("jdbc:datadirect:mongodb://myserver:27017;AuthenticationDatabase=mydb2;
    ProxyHost=pserver;ProxyPassword=psecret;ProxyPort=808;ProxyUser=PUser;
    DatabaseName=mydb;User=jsmith;Password=secret;");