且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用用户名和密码连接到Java中的MongoDB 3.2?

更新时间:2022-04-14 15:16:15

as MarkusWMahlberg 正确注意到,有必要记下连接字符串中的数据库名称。

As MarkusWMahlberg correctly noted, it is necessary to note the database name in the connection string.

例如:

String mongoClientURI = "mongodb://" + DB_SRV_USR + ":" + DB_SRV_PWD + "@" + DB_URL + ":" + DB_PORT + "/" + dbName;