How get oracle home list?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

How get oracle home list?

Post by sinys » Sun 08 Jul 2012 08:23

How I can get oracle home list?

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Re: How get oracle home list?

Post by jfudickar » Sun 08 Jul 2012 15:00

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

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: How get oracle home list?

Post by sinys » Sun 08 Jul 2012 18:34

Thank you!

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: How get oracle home list?

Post by sinys » Tue 31 Jul 2012 04:55

How I can set selected oracle home from combobox into OraSession?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How get oracle home list?

Post by AlexP » Tue 31 Jul 2012 08:21

hello,

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

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

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: How get oracle home list?

Post by sinys » Sat 11 Aug 2012 09:06

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])?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How get oracle home list?

Post by AlexP » Mon 13 Aug 2012 07:55

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.

sinys
Posts: 186
Joined: Tue 21 Feb 2012 03:44

Re: How get oracle home list?

Post by sinys » Mon 13 Aug 2012 08:25

Try to ask another.

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: How get oracle home list?

Post by AlexP » Mon 13 Aug 2012 09:37

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.

Post Reply