Access Data in cosmodb using mongodb API with SQL Server PolyBase fails with error

Mohammad Sufian 1 Reputation point
2020-07-20T14:57:31.11+00:00

I am trying to access data in my azure cosmosdb using SQL Server PolyBase (cosmosdb was created using "Azure Cosmos DB for MongoDB API)

Alert me|Edit|Change type
Question
You cannot vote on your own post
0
Hi All,

I am trying to access data in my azure cosmosdb using SQL Server PolyBase (cosmosdb was created using "Azure Cosmos DB for MongoDB API)

I am able to connect and access documents using mongo shell. However when trying to create external table, getting below error.

Searched though PolyBase logs and could not find any useful information which can help troubleshoot the issue.

Hence posting it here.

SQL Server version : Microsoft SQL Server 2019 (RTM-CU4) (KB4548597)

13072-capture.png

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,441 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Navtej Singh Saini 4,216 Reputation points Microsoft Employee
    2020-07-21T01:16:26.05+00:00

    @mohammadsufian-9623

    When we researched old cases raised with support we were able to find the cause of this which is: "SQL Server was not able to handle the MongoDB 3.6 URI format of mongo.cosmos.com properly."

    There were many things tried but what worked was to change the 2 lines "Polybase ODBC Driver for MongoDb.ini” file of the SQL Server files with location C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn\Polybase\ODBC Drivers\PolyBase ODBC Driver for MongoDb.ini

    The code that needs to be changed:
    a. Driver=PolyBase ODBC Driver for MongoDb\MongoDBODBC_sb64.dll
    b. Setup=PolyBase ODBC Driver for MongoDb\MongoDBODBC_sb64.dll

    You can also reference a similar issue in this Stack overflow post.

    Hope this helps.

    Regards
    Navtej S


  2. Navtej Singh Saini 4,216 Reputation points Microsoft Employee
    2020-08-17T18:36:28.013+00:00

    @Mohammad Sufian

    We have checked the ticket raised by you and we got to know the workaround provided by the team has been working for you.

    The workaround mentioned is : To use v3.2 format endpoints for v3.6 account. For example in below scripts, change original endpoint in “LOCATION” from *.mongo.cosmos.azure.com to *.documents.azure.com:

    18111-capture.jpg

    Support Team will still look into this as it might be a bug for Cosmos DB v3.6 account, so they have engaged our product team to investigate and confirm.

    Thanks
    Navtej S