Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reg Query and ODBC DSN's 1

Status
Not open for further replies.

briangriffin

Programmer
Nov 6, 2008
878
0
0
US
Windows Server 2008 R2 Datacenter

I'm trying to pull a list of DSN's into my application using reg query:

reg query "hklm\software\obdc\odbc.ini"

I can see the DSN's I want at that location in the registry, but the query is returning the DSN list from this location:

HKLM\Software\Wow6432Node\ODBC\ODBC.INI

This query returns the same DSN's as the first query:

reg query "hklm\software\Wow6432Node\obdc\odbc.ini"

Those are also the same DSN's shown when launching the 32 bit ODBC Administrator. When using the 64 bit ODBC Administrator the proper DSN's are shown.

I've never used reg query before, but I'm at a loss as to this behavior. What am I missing?

TIA.
 
You are running a 32-bit application on a 64-bit system, and the registry redirection feature is kicking in and catching your calls from the 32-bit application to the registry and redirecting it to the WOW6432Node that exists for 32-bit compatibility. If you query from a 64-bit tool (or perhaps using native PowerShell) then you should be able to get what you're looking for. Here's another solution:

________________________________________
CompTIA A+, Network+, Server+, Security+
MCTS:Windows 7
MCSE:Security 2003
MCITP:Server Administrator
MCITP:Enterprise Administrator
MCITP:Virtualization Administrator 2008 R2
Certified Quest vWorkspace Administrator
 
Bingo, the /reg:64 switch works perfectly and is sufficient for this application. Thanks for your quick reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top