How can i detect which version of Oracle is installed (by checking the registry)?

Hi:

I need to check from a Visual Basic program the version of Oracle that is installed on the machine so i can choose between two different connection strings.

I think the Windows registry is the place to look for it and for Oracle8i i found in the key
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
the string value ORACLE_HOME_NAME which is "OraHome81"

and for Oracle10g i found in the key
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1
the string value ORACLE_HOME_NAME which is "OraDb10g_home1"

However, as this application is installed on hundreds of server i want to be sure that checking those values is going to be enough for detecting the version of Oracle, i particularly feel unsure about the "OraDb10g_home1", can this differ depending on the installation and if so how can i know that indeed Oracle 10g is installed.

Thanks,

Johann
LVL 2
JohannRamonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
what would be the difference of the connection string?
what if both oracle8 and oracle 10 are installed?
0
vs1784Commented:
To retrieve the version information for Oracle, you execute the following SQL statement:

select * from v$version
where banner like 'Oracle%';

It should return something like this:

Banner
--------------------------------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
johnsoneSenior Oracle DBACommented:
I do not believe you can check the registry keys that way.  The "OraHome81" and "OraDb10g_home1" are values that are user input when the client is installed.  There are default values, but all you have to do is type over them.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

JohannRamonAuthor Commented:
angelll:

For Oracle 8i the connection string is:
sStringCnxion = "Provider=OraOLEDB.Oracle;Data Source=cn;User Id=/;Password="
And for oracle 10g the connection string is:
sStringCnxion = "Provider=OraOLEDB.Oracle;Data Source=cn;User Id=/;Password==;VCharNull=0" '

I need the "VCharNull=0" for Oracle 10g because of an issue that is detailed in this other question: http://www.experts-exchange.com/Database/Oracle/10.x/Q_23101382.html
Of course i already tried using the same connection string for 8i but have problems.

If both Oracle 8i and Oracle 10g are installed then i will use Oracle 10g.

Regards,

Johann
0
JohannRamonAuthor Commented:
vs1784:

Yep, but i need to set the connection string before connecting to the database...

I considered connecting, retreiving the version, disconnecting and then connecting again with the right connection string but it is not optimal and performance can be an issue.

Johann
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you could connect once when starting up the application, and do the check only once...
should not really a performance issue?!

0
JohannRamonAuthor Commented:
johnsone:

That is exactly what i'm worried about. I need to be sure about the version that is installed, it must be hidden somewhere!

Johann
0
johnsoneSenior Oracle DBACommented:
The problem is if there is more than one version installed.  How would you know that there is more than one version, and if there is how would you switch between them?  Simply changing the connect string will not do that.

I think the safest way is to connect and then if you are connected to 10, disconnect and reconnect with the additional parameters.  If there is any type of hit, it is one time.
0
J4M3S_UKCommented:
the performance difference will be marginal at best!
0
JohannRamonAuthor Commented:
Thanks all:

I really wanted to avoid the "pre-connection" way to solve this, especially because my VB program is a COM DLL and the first function that is called can change from one execution to another. There are other implications but that would be subject of another question.

I guess i should not be that stubborn and follow the approach of connecting first, disconnecting and reconnecting.

Working on the proof of concept, i will post again soon.

Johann
0
JohannRamonAuthor Commented:
Thanks again:

It was kind of difficult to split the points though ;) I tried to do my best and be fair.

Best regards,

Johann
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.