mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 561 forks source link

Invalid registry token store location #1231

Closed lamourj closed 1 year ago

lamourj commented 1 year ago

Dear all, I am writing here as I can't find the answer to my question anywhere and someone here might be able to help, although I understand that this error might not be caused by pyodbc and some windows layer behind. Thank you in advance for your precious help.

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:

Issue

OperationalError: ('08001', "[08001] The registry token store localtion 'registry://' is invaild (-1) (SQLDriverConnect)") after calling pyodbc.connect(<myconnstring>)

--> It seems my code (through Jupyter Notebook) can't access the registry, or rather that the registry location is wrong. I'm guessing the auth token cannot be stored, and hence the connexion fails to initialize, but I can't find where to specify another location to use. The driver I'm using, CData ODBC Driver for SugarCRM, does work properly when connecting through the configuration software they provide on this machine. On the other hand, the exact same code works perfectly well from another machine to connect to the DB.

I tried to search for the error message (including the typos) online but I can't find anything...

Did anyone ever run into this issue, and know how to solve it? Thank you

v-chojas commented 1 year ago

Have you tried asking CData?

lamourj commented 1 year ago

Not yet, but as I mentioned as far as I understand the problem is more linked to pyodbc/my python setup/ODBC windows drivers than the CData driver itself, given that I can connect properly with the UI they provide. The problem only appears when connection through pyodbc.

I’m guessing the problem boils down to being able to set the location to store the token… which I can’t find :(

v-chojas commented 1 year ago

pyODBC doesn't do anything special; are you connecting via DSN or specifying all parameters in connection string?

lamourj commented 1 year ago

I am connecting through a connexion string. As recommended here, I reached out to CData to ask about this issue, and they could solve my problem. For the ones running into it in the future, here is the solution: Add the following parameter: OAuthSettingsLocation='C:\Users\Public\OAuthSettings.txt' (or any other location to which the current user has access to).

Thank you for your help!