LDAP authentication
- Last Updated: August 3, 2021
- 1 minute read
- DataDirect Connectors
- JDBC
- MongoDB 6.1
- Documentation
This string includes the properties used to connect with LDAP (Lightweight Directory Access Protocol) authentication.
jdbc:datadirect:mongodb://host:port;AuthenticationMethod=plain;DatabaseName=database;
User=username;Password=password;[property=value[;...]];
where:
- host
-
specifies the name or 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.
- 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.
- user
- (optional) 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.
Important: When LDAP authentication is enabled, credentials are passed in clear
text. Therefore, you should use LDAP authentication only on servers that are configured for
TLS/SSL encryption.
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 connecting with LDAP authentication.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:mongodb://myserver:27017;AuthenticationMethod=plain;
DatabaseName=mydb;user=jsmith;password=secret;");