List of databases in tnsnames.ora

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
DuckyDuck
Posts: 16
Joined: Mon 06 Apr 2009 07:58

List of databases in tnsnames.ora

Post by DuckyDuck » Sat 03 Apr 2010 13:02

Does ODAC provide a means to get this list of databases or I do I need to do it the hard way and write code to trawl through the TNSNAMES.ORA file ?

I would like to create a custom logon screen that allow the user to select from a list of databases that are obtained from TNSNAMES.ORA

I know that this will only work for TNSNAMES.ORA file and wont support TNSNAMES server, but that is ok.

thanks

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

Post by JoelH » Tue 06 Apr 2010 05:28

i use this function to do that. I found it in an other thread here in the forum. ( http://www.devart.com/forums/viewtopic. ... enumerator )

Code: Select all


uses OraServices;

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;

Post Reply