Page 1 of 1

List of databases in tnsnames.ora

Posted: Sat 03 Apr 2010 13:02
by DuckyDuck
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

Posted: Tue 06 Apr 2010 05:28
by JoelH
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;