1

Im trying to connect SQL server using Polybase with MongoDB but Im failing to create the external data source for that. Please help ...

Im using the following code:

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'mypassword';  

CREATE DATABASE SCOPED CREDENTIAL MongoDbUser
WITH IDENTITY = 'myusername', Secret = 'thepassword';


CREATE EXTERNAL DATA SOURCE external_DS_MongoDB
WITH (
TYPE = HADOOP,
LOCATION = 'mongodb://localhost:27017', 
CREDENTIAL = MongoDbUser
);

Im expecting the create the datasource with name "external_DS_MongoDB" but Im facing the following error in SQL:

Msg 105007, Level 16, State 1, Line 26 Scheme of the input URI is not supported. Please revise the following scheme and try again: 'mongodb'

Can anybody advice me ?

Thanks.

GregGalloway
  • 11,355
  • 3
  • 16
  • 47
Amir
  • 11
  • 2

1 Answers1

2

TYPE is not needed when creating a MongoDB data source:

CREATE EXTERNAL DATA SOURCE external_DS_MongoDB
WITH 
(
LOCATION = 'mongodb://localhost:27017', 
CREDENTIAL = MongoDbUser
);
ChrisK
  • 21
  • 1
  • For future users, the topic is well documented [here](https://learn.microsoft.com/en-us/sql/relational-databases/polybase/polybase-configure-mongodb?view=sqlallproducts-allversions) – Ronen Ariely Apr 07 '19 at 01:35