1

At my work we have Windows 10 and we use ODBC to connect to databases from SPSS, Rstudio and other apps. Recently we added a new registry entry to register a new database connection:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\MYDATABASE123]
"Driver"="C:\\WINDOWS\\system32\\SQLSRV32.dll"
"Description"="MYDATABASE123"
"Server"="lab_prod.db.mydomain.com"
"Database"="labresults_P01"
"Trusted_Connection"="Yes"

And after I add this using a .reg file, I can connect to the database using the ODBC source MYDATABASE123, so this all works fine.

However, when I open either the ODBC Data Sources (64-bit) or ODBC Data Sources (32-bit) from the startmenu, I don't see this entry anywhere, not on the "User DNS" tab or on the "System DNS" tab or any other tab.

enter image description here

I noticed that another (older) entry under HKEY_LOCAL_MACHINE\Software\ODBC is visible, so I tried adding my new entry also at that same place in the registry, but then it's still not visible in the ODBC Data Sources. So I've added both:

Computer\HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\MYDATABASE123
Computer\HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\MYDATABASE123

enter image description here

So my question is

  • why is it that this ODBC connection is active (I can infact use it) but not visible in the ODBC Data Sources?
  • Do I have to add the ODBC data source at some other place?
4
  • Are you perhaps adding an entry which points to a 32-bit DLL, into the 64-bit Registry? Commented Feb 19 at 10:51
  • @u1686_grawity Thanks for the suggestion but no that's not it. Both the 32bits or 64bits drivers are displayed, regardless of whether you open the 32-bit or 64-bit ODBC Data Sources. The only difference is that when you open for example the 64bit ODBC, then you can only edit 64bit entries, but afaik it should show all entries.
    – BdR
    Commented Feb 19 at 10:58
  • @BdR They DON'T show all entries as far as I know.
    – Tonny
    Commented Feb 19 at 11:09
  • Access 365 can also use key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office\ClickToRun\REGISTRY\MACHINE\Software\ODBC\ODBC.INI\ODBC Data Sources. Note also that Access can open an ODBC connection without a DSN by using the data under your registry key, the Windows API does not oblige using a DSN.
    – harrymc
    Commented Feb 19 at 11:49

1 Answer 1

1

I've figured it out, so I'll answer my own question. The reason the datasource is invisible in the ODBC Data Source Administrator, is that it also needs a referring entry with the same name under HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources. So if you add the registry keys using a .reg file like below, then the datasource entry will be visible and editable in ODBC Data Source Administrator app.

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\MyDatabase123]
"Driver"="C:\\WINDOWS\\system32\\SQLSRV32.dll"
"Description"="Comment description for My Database 123"
"Server"="lab_prod.db.mydomain.com"
"Database"="labresults_P01"
"Trusted_Connection"="Yes"
[HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources]
"MyDatabase123"="SQL Server Native Client 11.0"

Btw you can add it under HKEY_CURRENT_USER so it appears under the User DNS tab (only for current user), or HKEY_LOCAL_MACHINE and it appears under the System DNS tab (for all users). Hope this helps anyone with the same issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .