Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error when adding DSN for MongoDB in MS Excel #101

Open
sagar-gopale opened this issue Mar 28, 2024 · 5 comments
Open

Getting error when adding DSN for MongoDB in MS Excel #101

sagar-gopale opened this issue Mar 28, 2024 · 5 comments

Comments

@sagar-gopale
Copy link

I am using

  • MacOs Ventura version 13.3.1(a).
  • MS Excel version 16.78
  • I have installed iODBC version 3.52.16 driver for MacOS Ventura from https://www.iodbc.org/dataspace/doc/iodbc/wiki/iodbcWiki/Downloads
  • I have tried this with local mongo server as well as remote Mongo cluster from Atlas.
  • I am able to connect to the Mongo cluster using MongoAtlas client(To be sure that there are no network restrictions)
  • The mongosqld utility is also running and it is able to sample schemas from MongoDB(as seen in logs).

Below is what my mongosqld config looks like for local mongodb connection.

## This is a example configuration file for mongosqld.

## The full documentation is available at:
## https://docs.mongodb.com/bi-connector/master/reference/mongosqld/#configuration-file

## Network options - configure how mongosqld should accept connections.
## https://docs.mongodb.com/bi-connector/master/reference/mongosqld/#network-options
net:
  bindIp: "127.0.0.1"
  port: 3307
  ssl:
    mode: "disabled"
mongodb:
  net:
    uri: "mongodb://localhost:27017" # https://docs.mongodb.com/manual/reference/connection-string/#mongodb-uri
    ssl:
      enabled: false

## Logging options
systemLog:
  path: './mongosql.log'
  quiet: false
  verbosity: 1
  logAppend: true
  logRotate: "reopen" # "rename"|"reopen"

## Schema options
schema:
  refreshIntervalSecs: 0
  stored:
    mode: "auto" # "auto"|"custom"
    source: "<myDatabase>" # the database where schemas are stored in stored-schema modes
    # name: "" # the named schema to read/write to in stored-schema modes
  sample:
    size: 1000 # The amount of random documents we sample from each collection.
    namespaces: ["*.*"]
processManagement:
  service:
    name: "mongosql"
    displayName: "MongoSQL Service"
    description: "MongoSQL accesses MongoDB data with SQL"

I am using below values when adding System DSN in MS Excel.

- SERVER=127.0.0.1
- PORT=3307
- DATABASE=<myDatabase>
- UID=<myUsername>?source=admin # In case of remote MongoDB Atlas cluster
- PWD=<myPwd> # In case of remote MongoDB Atlas cluster

I can see below drivers in MS Excel when adding System DSN. I have tried with both.

Screenshot 2024-03-28 at 1 02 44 PM

I get below error dialog when I try to create DSN.

Screenshot 2024-03-28 at 1 04 00 PM

I am not sure how to debug this. I have tried the solution at #34. Changing the permission of odbcinst.ini that is present in /Library/ODBC.
NOTE: I am the administrator on this system.

@HughWilliams
Copy link
Collaborator

Are you running on a macOS Intel or M1 machine ?

Where did you obtain the indicated MongoDB 1.4.5 ODBC drivers from ?

If you create the ODBC DSN using the iODBC Administrator directly , rather than in MSExcel, does the same error occur creating the ODBC DSN in the iODBC Administrator ?

@sagar-gopale
Copy link
Author

@HughWilliams

  1. I am running a M1 machine.
  2. I considered that the listing of ODBC 1.4.5 is coming because I installed iODBC version 3.52.16 driver for MacOS Ventura from I have installed iODBC version 3.52.16 driver for MacOS Ventura from https://www.iodbc.org/dataspace/doc/iodbc/wiki/iodbcWiki/Downloads. Is it not the case?
  3. I have not tried using iODBC Administrator directly. I did not know about this and update.

@HughWilliams
Copy link
Collaborator

iODBC does not provide an ODBC driver just the ODBC Driver Manager components, so some thing or someone else must have installed the MongoDB ODBC 1.4.5 driver on your machine.

What is in the /Library/ODBC/odbc.ini and /Library/ODBC/odbcinst.ini file on your machine, which should provide the file name of the ODBC driver and location, and might be a hint as to its origin ?

@smalinin
Copy link
Collaborator

smalinin commented Apr 3, 2024

@sagar-gopale
Don't try add DSN under MS Excell. Run iODBC Administrator App directly and create new DSN.
MS Excell is sandboxed app, so if you run iODBC Administrator under MS Excell, you must have issues with files access.

@smalinin
Copy link
Collaborator

smalinin commented Apr 3, 2024

@sagar-gopale
Also look at => #29 (comment)
and #97
If your MongoDB ODBC driver uses some dynamic libs that is installed for example to /usr/local/libs or MongoDB ODBC driver installed to /usr/local/libs or etc, so MongoDB ODBC driver could NOT be loaded by MSExcell , because sandboxed app doesn't have access to this locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants