Server name for mongodb

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Server name for mongodb

Post by inageib » Sun 04 Mar 2018 22:48

I am trying to connect to mongodb from unidac and I supplied server name like this

cluster0-shard-00-00-xxxxx.mongodb.net

also port 27017, user name and password but I did not able to connect from Delphi !! why is that ? I was able to connect from mongodb compass btw

error:
Failed to read 66321 bytes from socket within 300000 milliseconds..
I am trying to connect to MongoDB Atlas not a local server

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Server name for mongodb

Post by azyk » Tue 06 Mar 2018 13:00

Perhaps the reason for this error is not UniDAC, but the client libraries that you use to connect to MongoDB Atlas.

Try to use the libbson-1.0.dll and libmongoc-1.0.dll client libraries from Devart ODBC Driver for MongoDB for Windows ( https://www.devart.com/odbc/mongodb/download.html ) to avoid this error. By default, 32-bit versions of these libraries will be installed to the "C:\Program Files (x86)\Devart\ODBC\MongoDB\Win32\" folder.
For example:

Code: Select all

  UniConnection1.ProviderName := 'MongoDB';
  UniConnection1.Server := 'cluster0-shard-xx-xx-xxxxx.mongodb.net';
  UniConnection1.Port := 27017;
  UniConnection1.Username := 'username';
  UniConnection1.Password := '********';
  UniConnection1.SpecificOptions.Values['MongoDB.BSONLibrary'] := 'C:\Program Files (x86)\Devart\ODBC\MongoDB\Win32\libbson-1.0.dll';
  UniConnection1.SpecificOptions.Values['MongoDB.ClientLibrary'] := 'C:\Program Files (x86)\Devart\ODBC\MongoDB\Win32\libmongoc-1.0.dll';
  UniConnection1.SpecificOptions.Values['MongoDB.ConnectionOptions'] := 'ssl=true&replicaSet=Cluster0-shard-0&authSource=admin';

  UniConnection1.Connect;

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Re: Server name for mongodb

Post by inageib » Tue 06 Mar 2018 13:33

I installed odbc drivers and set all parameters now I get error:
Access violation at address 001948D3 in module 'libmongoc-1.0.dll'. Read of address 00000224.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Server name for mongodb

Post by azyk » Tue 06 Mar 2018 13:56

Please specify the full versions of the used RAD Studio and UniDAC.

If you can provide us with test credentials to connect to your MongoDB Atlas, plase
write to us using the contact form at our site: https://www.devart.com/company/contactform.html

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Re: Server name for mongodb

Post by inageib » Tue 06 Mar 2018 13:58

unidac 7.1.4 and Delphi Tokyo edition

I will email later the login info... thanks

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Server name for mongodb

Post by azyk » Tue 06 Mar 2018 14:13

We tested UniDAC 7.2.5 with MongoDB Atlas, Devart client libraries (libbson-1.0.dll, libmongoc-1.0.dll) and found no issues. Please specify whether the issues is reproduced on the latest UniDAC version 7.2.5. You can download it by the link on our website: https://www.devart.com/unidac/download.html .

inageib
Posts: 184
Joined: Wed 26 Aug 2009 14:11

Re: Server name for mongodb

Post by inageib » Wed 07 Mar 2018 04:24

thanks alot. Yes using latest version I was able to connect to mongo atlas

Post Reply