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?
 
vs1784Connect With a Mentor Commented:
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
 
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
 
johnsoneConnect With a Mentor Senior 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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
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]Connect With a Mentor 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
 
johnsoneConnect With a Mentor Senior 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
All Courses

From novice to tech pro — start learning today.