Page 1 of 1

How get oracle home list?

Posted: Sun 08 Jul 2012 08:23
by sinys
How I can get oracle home list?

Re: How get oracle home list?

Posted: Sun 08 Jul 2012 15:00
by jfudickar
You can use the following code

Code: Select all

for i := 0 to OracleHomeCount - 1 do
  Items.Add(OracleHomeNames[i]);
The variables are defined in the OraCalls unit.

Regards
Jens

Re: How get oracle home list?

Posted: Sun 08 Jul 2012 18:34
by sinys
Thank you!

Re: How get oracle home list?

Posted: Tue 31 Jul 2012 04:55
by sinys
How I can set selected oracle home from combobox into OraSession?

Re: How get oracle home list?

Posted: Tue 31 Jul 2012 08:21
by AlexP
hello,

The name Oracle Home is set in the OraSession1.HomeName property:

OraSession1.HomeName := ComboBox1.Items[ComboBox1.ItemIndex];

Re: How get oracle home list?

Posted: Sat 11 Aug 2012 09:06
by sinys
I get TNS file name like this

Code: Select all

var
  tnsPath : String;
  t : TOraServerEnumerator;
begin
  t := TOraServerEnumerator.Create;
  try
    tnsPath := t.GetTNSFileName;
  finally
    t.free;
  end;
end;
but this is current TNS file name, how I can get TNS file name selected from combobox (ComboBox1.Items[ComboBox1.ItemIndex])?

Re: How get oracle home list?

Posted: Mon 13 Aug 2012 07:55
by AlexP
hello,

The GetTNSFileName method returns the name and path to the tnsnames.ora file, that corresponds tothe selected value of Home.
The OraSession dialog is a design-time component, and in the selected ComboBox HomeName is set to the TOraSession.HomeName property, from that you can retrieve the name of the current Home in run-time.
but this is current TNS file name, how I can get TNS file name selected from combobox

in run-time you will always get the HomeName that was set in the OraSession dialog in design-time, if it wasn't changed and is correct (such HomeName exists and registerred on the current PC), if the selected HomeName doesn't exist, the default HomeName will be used.

Re: How get oracle home list?

Posted: Mon 13 Aug 2012 08:25
by sinys
Try to ask another.

In my ComboBox1 (OracleHomeNames) 5 values. How I can show all 5 tnsnames.ora file paths?

Re: How get oracle home list?

Posted: Mon 13 Aug 2012 09:37
by AlexP
Hello,

To retrieve all paths to the installed Oracle clients, you can use the following code:

Code: Select all

  try
    DetectOCI; 
  except
  end;
  for i := 0 to OracleHomeCount - 1 do
    ShowMessage(OracleHomePaths); 
Moreover, you can retrieve all the information about Oracle clients from the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\ registry branch even with no using of our components.