Page 1 of 1

Looking for TOraServerEnumerator in UniDac

Posted: Thu 17 Dec 2015 06:40
by JoelH
Until now i used ODAC and the following function to receive the list of all the Oracleservers avalible on the PC

Code: Select all

function  Tfrm_intro.getServerlist:TStringlist;
var
  Enum: TOraServerEnumerator;
  List: TStringList;
begin
  List := TStringList.Create;
  Enum := TOraServerEnumerator.Create;
  try
    Enum.GetServerList(List);
  finally
    Enum.Free;
  end;
  result := List;
end;
Now my company switch to UniDac and after the migration the function works no more. Which Unit provides the TOraServerEnumerator functionality?

Re: Looking for TOraServerEnumerator in UniDac

Posted: Fri 18 Dec 2015 05:41
by AlexP
Hello,

This class is declared in the OraServerEnumeratorUni module.

Re: Looking for TOraServerEnumerator in UniDac

Posted: Fri 18 Dec 2015 08:35
by JoelH
Thank you, now i can compile it, but the list is empty :(

Re: Looking for TOraServerEnumerator in UniDac

Posted: Fri 18 Dec 2015 11:42
by AlexP
Make sure the Oracle client is installed on the PC, and the data is available in the tnsnames.ora file. If everything is OK, try to call initialization of Oracle Home explicitly:

Code: Select all

  
  ...
  OracleHomes.Init;
  Enum := TOraServerEnumerator.Create;
  ...

Re: Looking for TOraServerEnumerator in UniDac

Posted: Tue 22 Dec 2015 14:06
by JoelH
Hi AlexP,

that didn't worked, but it helped me to figure out the problem. For me it looks like a bug in the new UniDac Release 6.2.9.

I stepped back to 6.1.4 and tried the code

Code: Select all

function  Tfrm_intro.getServerlist:TStringlist;
var
  Enum: TOraServerEnumerator;
  List: TStringList;
  s  : String;
  x : TOraclehome;
begin
  OracleHomes.Init;
  List := TStringList.Create;
  Enum := TOraServerEnumerator.Create;

  s := Enum.GetTNSFileName(OracleHomes.Homes[0]);
  try
    Enum.GetServerList(List);
  finally
    Enum.Free;
  end;
  result := List;
end;
With UniDac 6.1.4 Release it worked perfectly. And the Debugger showed:
Oraclehomes.homes[0] =
('OraClient11g_home1', 'C:\app\Image-Benutzer\product\11.1.0\client_1', '', '', '', '', 0, None, False, [])
and
s =
'H:\TNSNAMES\EDV\tnsnames.ora'
the right filename.

but after updating to 6.2.9 the debugging results were:
Oraclehomes.homes[0] =
('OraClient11g_home1', 'C:\app\Image-Benutzer\product\11.1.0\client_1', 'H:\TNSNA', '', '', '', 0, None, False, [])
ans s was empty.

The FTNSPath 'H:\TNSNA' is wrong, like you can see in the first testrun.

Re: Looking for TOraServerEnumerator in UniDac

Posted: Wed 23 Dec 2015 08:29
by AlexP
Thank you for the information, we have reproduced and fixed the issue. This fix will be included in the next version.