Getting available Oracle databases from tnsnames.ora file?

10-13-2004, 03:51 PM
How do I get a list of the available Oracle databases from my tnsnames.ora file and bring that into VB? I would like to be able to give the user the option of picking which database to query. Thanks...

10-13-2004, 05:36 PM
I bel;ieve you would need to interrogate the resistry on the computer to determine the actual location of the tnsnames.ora file. At our site, most users are set to get the tnsnames from a shared network folder, where the dba use local copies of tnsnames.

Offhand, I don't know which registry entry it is, though.

10-13-2004, 10:13 PM
You can read the TNSnames.ora. Create a loop, and search for the text 'SERVICE_NAME' this is usually followed by the database name. Example: 'SERVICE_NAME = Database1'

Perhaps you can take a look at this path. It is where tnsnames.ora exist.

10-14-2004, 07:48 AM
Yes, but some computers may have different/multiple Oracle homes. Which could make the directory different.

Is this information stored in the registry anywhere? Also, if the only way to do this is to search for and parse the tnsnames.ora file, does anyone have any code to do this?

Thanks for the responses...

10-15-2004, 08:09 PM
Regarding the registry, not really :).

What version of Oracle are you working with?

Once you connect to a Oracle server (working within a live connection), you may be able to filter by owner, or schema, this would also provide a mechanism for getting all assumed db names on that specific server.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum