MongoDB - how to set Authentication Database ?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ernschd666
Posts: 11
Joined: Wed 15 Jul 2015 11:54

MongoDB - how to set Authentication Database ?

Post by ernschd666 » Wed 29 Jul 2020 09:47

Hi,

I've created a read-only user in MongoDB for a existing Database ('Test'). Connecting with several Client Software works (e.g. Nosqlclient).

Now i like to connect with UniDAC, but i don't know how to specify the 'Authentication Database'.
I have tried in vain in various ways in "ConnectionOptions" like

Code: Select all

authenticationDatabase='Test'
--authenticationDatabase='Test'
authenticationDatabase "Test"
What is the right way to do this?

I'm using UniDAC 7.2.7 on Delphi 10.2

Thanks in advance.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: MongoDB - how to set Authentication Database ?

Post by ViktorV » Fri 31 Jul 2020 15:06

You can specify additional connection options in the TUniQuery.SpecificOptions.Values['Connection options'] property. For your task, you need to use the authSource option (docs.mongodb.com/manual/reference/connection-string/).
Please try to set the authSource option to Test (authSource=Test) in Connection options and then connect.

ernschd666
Posts: 11
Joined: Wed 15 Jul 2015 11:54

Re: MongoDB - how to set Authentication Database ?

Post by ernschd666 » Thu 06 Aug 2020 12:30

Thank you, that works.

Now I have another problem: I wanted to run the application on Windows XP.
When I start the application I get the error message that bcrypt.dll was not found.
Is it possible that it is not executable under XP? I have libbson-1.0.dll and libmongoc-1.0.dll in the same path as the exe file.

What can I do now?

Best regards.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: MongoDB - how to set Authentication Database ?

Post by ViktorV » Fri 07 Aug 2020 11:35

As you can see using the link http://mongoc.org/libbson/1.3.5/install ... ng-windows, building on Windows requires Windows Vista or newer.

Post Reply