I am a desktop support technician currently working on a large scale migration project across multiple sites. I am looking at a way to transfer ODBC entries from Windows XP to Windows 7. If anyone knows of a program or anything prebuilt that already does this, please redirect me. I've already looked but haven't found anything, so I'm trying to build my own.

I know enough basic programming to read the work of others and monkey around with something that already exists, but not much else. I have come across a custom batch file written at one site that (among other things) exports ODBC information from the old computer and stores it on a server (labelled as y: through net use at the beginning of the file), then later transfers it from the server to a new computer. The pre-existing code is for Windows XP to XP migrations. Here are the pertinate bits of code:

echo Exporting ODBC Information
start /wait regedit.exe /e "y:\%username%\odbc.reg" HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI

(and later on)

echo Importing ODBC
start /wait regedit /s "y:\%username%\odbc.reg"

We are now migrating from Windows XP to 7, and this part of the batch file still seems to work for this particular site, where Oracle 8i and 10g are used. I'm looking to use my cut down version of this code at multiple sites, and I'm wondering if the same lines of code will still work for anything other than Oracle.

Also, my research on this issue has shown that there are different locations in 64 bit operating systems for 32/64 bit entries, and I'm wondering what effect that would have on the code. Could I copy the same data to both parts of the registry, in hopes of catching everything?

Any assistance would be appreciated. Thank you for your time.


Yes, you're on the right track. There are actually two registry keys you'll be interested in depending on if you've set custom TCP ports for the ODBC connections, etc:



HKLM is where System DSNs are stored. HKCU is where User DSNs are stored for the current user.

The Wow6432Node part will only be present if you are looking at 32bit ODBC entries on a 64bit system. If you are looking at 32bit ODBC entries on a 32bit system, you will not see the Wow6432Node folder. If you are looking at 64bit ODBC entries on a 64bit system, you will not see the Wow6432Node folder. (You can substitute "32bit on 32bit" and "64bit on 64bit" for the word "native.") You can run 32bit code on a 64bit computer but it is not considered "native."

If you are exporting the ODBC entries from a 32bit platform and importing them into a 64 bit OS, you will need to put them in the appropriate place under the Wow6432Node folder.

To see this another way, get on a 64bit Windows 7 computer. Run Windows\System32\odbcad32.exe. That is the native (64bit version.) Add an ODBC connection in there.

Now run Windows\SysWOW64\odbcad32.exe on the same machine. That is the 32bit version (WoW64 stands for Win32 Emulation on 64bit Windows.) You will notice that the ODBC connection that you created is not there. Because you're not looking at native ODBC connections anymore. You're looking at 32bit ones.

That is why you have to pay attention to the architecture that the ODBC connection is coming from, and the architecture that you're importing it to.

edit: My explanation is probably about as clear as mud, but if you want a better explanation of file system redirection and registry redirection for 32bit processes running on 64bit Windows, I highly suggest Windows Internals, 6th Ed. by Mark Russinovich, et al. Part I, Chapter 3.

edit #2: No you cannot just copy the registry keys to both places and hope to cactch everything. The system will prefer the native ones, which will not work if they needed to be in the 32bit context.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.