Is it possible to get Data from a MongoDB Atlas Cluster to SQl Server using PolyBase?

Hello,

I’m setting up my PolyBase to access external data in MongoDB Atlas; However, I couldn’t set properly the location.

I tried this:

CREATE EXTERNAL DATA SOURCE mongodb_base360
WITH (LOCATION = ‘mongodb://cls-data-cross-data-sma.a8m8q.mongodb.net’,
CREDENTIAL = mongodb_base360
)

CREATE EXTERNAL TABLE base360(
[_id] NVARCHAR(24) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ds_Contexto] nvarchar(max))
WITH (
LOCATION=‘[db-data-integration].[db-mng-ins-base360-apolice-erro-dev]’,
DATA_SOURCE= mongodb_base360
);

But I got the following error when I tried to create my external table :

105082;Generic ODBC error: [Microsoft][MongoDBODBC] (110) Error from MongoDB Client: No suitable servers found (serverSelectionTryOnce set): [Failed to resolve ‘cls-data-cross-data-sma.a8m8q.mongodb.net’] (Error Code: 13053) Additional error <2>: ErrorMsg: [Microsoft][MongoDBODBC] (110) Error from MongoDB Client: No suitable servers found (serverSelectionTryOnce set): [Failed to resolve ‘cls-data-cross-data-sma.a8m8q.mongodb.net’] (Error Code: 13053), SqlState: HY000, NativeError: 110 .

Can anyone help me please ?

Thank you,
Juliano Medeiros

PolyBase : Access external data: MongoDB - PolyBase - SQL Server | Microsoft Learn

The error message is stating it couldn’t find the server by name, try to ping it or use the IP address instead. Apart from the server name, you need to specify the port; for MongoDB it is supposed to be 27017, but check your server and try to telnet into the port to verify it is accessible from SQL Server. You also need to specify CONNECTION_OPTIONS if SSL is disabled, or install the security certificate in SQL Server side. You can learn how to set up a test environment locally using Docker in my book “Hands-on data virtualization with Polybase”.