1

I am working on 2 virtual machines to test legacy application functionality on new platforms, with an OS & DB upgrade. The application that is being tested on the new client (Win7Prox64) was written in VB6. (It's pretty old!) When the application launches, it opens a form that allows users to login. The old DB it connected to was 11G on Server2003SP2 32bit box and the app ran on a 32bit XP client. (The new VM for the new server for test is 2008R2x64).

The legacy app has the the following declared: ("frmLogin.frm") (The app checks the registry for the location of tnsnames by assigning the correct directory paths to these Const's)

Private Const MODULE_NAME = "frmLogin"
Private Const REG_APP_KEY = "Software\ORACLE\HOME"
Private Const REG_APP_PATH = "Oracle_Home"
Private Const REG_ALL_HOMES = "Software\Oracle\ALL_HOMES"
Private Const REG_LAST_HOME = "LAST_HOME"
Private Const REG_MYAPP_KEY = "Software\company\myapp"
Private Const MYAPP_APP_KEY = "Database Host Name"

I assume I have to change these constants to the new hierarchy found with 11GR2 to make it work correctly, how do I check and update these? I'm not sure it's as easy as just changing the directories above, but I could be wrong.

Any tips welcome.

EDIT: I notice 11GR2 on Win7 64 registry entries are alot different to XP 32bit with 11G. Both in layout and content. LAST_HOME for example doesn't seem to exist on Win7, any advice?

I hard coded a reference to the location of tnsnames.ora into the app, and I know that it runs (and seems to run well) on the new 64bit client, but I cannot hardcode it for each and every client machine it will reside on, so need to re-point the directories correctly.

GrumP
  • 1,183
  • 6
  • 19
  • 43

1 Answers1

0

You have to go through every registry key in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_***, since there are possibly multiple installations on one system.

Go to HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE in the registry, then check every sub key if it starts with KEY_. (pick the first if you don't care, if you do, go through every one)

In those keys you will find:

  • The TNS_ADMIN, the deviating location where the tnsnames.ora will be saved;
  • The ORACLE_HOME where you need to append network\admin where the tnsnames.ora will generally be found.
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
  • Not sure I follow, this is only what I see: http://i.imgur.com/J2SP0mE.jpg & totally different hierarchy and keys on XP: http://i.imgur.com/NIIMtqP.jpg (The app works on this, I need to modify my vb6 code so it works on the first image) – GrumP Mar 03 '14 at 10:55
  • This is how the code currently computes the location in XP: strOHD = GetRegistryKey(strKey & GetRegistryKey(REG_ALL_HOMES, REG_LAST_HOME, bLocal_Machine:=True), _ REG_APP_PATH, bLocal_Machine:=True) strfilename = strOHD & "\network\admin\tnsnames.ora" – GrumP Mar 03 '14 at 11:10
  • I can get it to work in Win7x64 if I modify it to this: '//strfilename = "C:\app\username\product\11.2.0\client_1\network\admin\tnsnames.ora" But this hardcoding is not suitable. – GrumP Mar 03 '14 at 11:11
  • @GrumP: take a look [here](http://support.microsoft.com/kb/267908) to find all sub keys. The code is too extensive to past here. – Patrick Hofman Mar 03 '14 at 11:23
  • Tried that link with 2012 & 2008 Visual Studio's and both littered with errors. – GrumP Mar 03 '14 at 13:40
  • Yes, have it working now. I foolishly wasn't running for vb6. It compiles now. How exactly it is helpful, isn't clear though. – GrumP Mar 03 '14 at 14:01
  • The link you provided creates a small app that lists registry entries, it doesn't appear to assist further than viewing regedit does. – GrumP Mar 03 '14 at 14:16
  • @GrumP: the demo uses `RegEnumKeyEx`. That is the key to your answer. Using that, and the logic below the call, you can iterate through all the keys as suggested in my answer. – Patrick Hofman Mar 03 '14 at 14:21