Feedback
Did this article resolve your question/issue?

   

Article

Configuring MongoDB JDBC driver to connect to a MongoDB clustered env

Information

 
TitleConfiguring MongoDB JDBC driver to connect to a MongoDB clustered env
URL Nameconfiguring-mongodb-jdbc-driver-to-connect-to-multiple-nodes-in-replica-set
Article Number000113090
EnvironmentProduct: Progress DataDirect for JDBC for MongoDB driver
Version: 6.0
OS: Windows
Database: MongoDB
Application: All supported applications
Question/Problem Description
MongoDB clustered environment has three MongoDB servers in the replicaSet.
How do you configure your JDBC connection URL to connect to the MongoDB cluster?
Steps to Reproduce
Clarifying Information
Error Message
Defect Number
Enhancement Number
Cause
Resolution
For JDBC Connection URL, you can only provide one host name and port number. Recommended to provide the IP address of the primary member of the replica set.
And also you need to provide the connection option ReadPreference as described in the following document:
https://documentation.progress.com/output/DataDirect/jdbcmongohelp/index.html#page/mongohelp%2Freadpreference.html%23

During the connect process, the driver queries the server for a list of nodes in the replica set, as well as their current roles (i.e. primary or secondary). The driver uses this information to determine whether the current server meets the ReadPreference requirement specified by the application, or whether it needs to disconnect and reconnect to one of the other nodes in the replica set. 
Workaround
Notes
References to other documentation:
Progress DataDirect for JDBC for MongoDB driver User's Guide and Reference : "MongoDB Sharding Support"
https://documentation.progress.com/output/DataDirect/jdbcmongohelp/index.html#page/mongohelp/mongodb-sharding.html

Progress DataDirect for JDBC for MongoDB driver User's Guide and Reference, "Connection Option Descriptions" : "Read Preference"
https://documentation.progress.com/output/DataDirect/jdbcmongohelp/index.html#page/mongohelp%2Freadpreference.html%23

Progress Article(s):
 Is failover supported once a JDBC connection is established with MongoDB replica set?
Last Modified Date11/20/2020 7:02 AM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.