Getting available Oracle databases from tnsnames.ora file?

Orbital808
10-13-2004, 04: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...

loquin
10-13-2004, 06: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.

NEOLLE
10-13-2004, 11: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.
c:\orant\client\network\ADMIN\tnsnames.ora

Orbital808
10-14-2004, 08: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...

MKoslof
10-15-2004, 09: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