Looking for TOraServerEnumerator in UniDac

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JoelH
Posts: 7
Joined: Thu 01 Apr 2010 10:48
Location: Germany

Looking for TOraServerEnumerator in UniDac

Post by JoelH » Thu 17 Dec 2015 06:40

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?

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

Re: Looking for TOraServerEnumerator in UniDac

Post by AlexP » Fri 18 Dec 2015 05:41

Hello,

This class is declared in the OraServerEnumeratorUni module.

JoelH
Posts: 7
Joined: Thu 01 Apr 2010 10:48
Location: Germany

Re: Looking for TOraServerEnumerator in UniDac

Post by JoelH » Fri 18 Dec 2015 08:35

Thank you, now i can compile it, but the list is empty :(

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

Re: Looking for TOraServerEnumerator in UniDac

Post by AlexP » Fri 18 Dec 2015 11:42

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;
  ...

JoelH
Posts: 7
Joined: Thu 01 Apr 2010 10:48
Location: Germany

Re: Looking for TOraServerEnumerator in UniDac

Post by JoelH » Tue 22 Dec 2015 14:06

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.

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

Re: Looking for TOraServerEnumerator in UniDac

Post by AlexP » Wed 23 Dec 2015 08:29

Thank you for the information, we have reproduced and fixed the issue. This fix will be included in the next version.

Post Reply