get tnsnames alias list?

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

get tnsnames alias list?

Post by albourgz » Fri 21 Aug 2009 14:48

Dear all,

I would like to use my own connect box, using a username/password that do not correspond to a oracle user.
Is there a way to get the list of the available aliases in tnsnames.ora?

Regards,
Alain

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 25 Aug 2009 08:31

You can use the following code:

Code: Select all

uses
  OraServices;
...
var
  Enum: TOraServerEnumerator;
  List: TStringList;
begin
  List := TStringList.Create;
  Enum := TOraServerEnumerator.Create;
  try
    Enum.GetServerList(List);
  finally
    Enum.Free;
  end;
end;

jjeffman
Posts: 84
Joined: Tue 09 Nov 2004 12:22
Location: Porto Alegre-Rio Grande do Sul - Brazil

BUG on TOraServerEnumerator.GetServerList method

Post by jjeffman » Mon 12 Oct 2009 17:06

:? Hello to all.

I have found a connection definition like the example below :

Code: Select all

: TNSNAMES.ORA
SRV1, SRV2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.10.10.10)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = MYORA)
      (SERVER = DEDICATED)
    )
  )

The method returns a string without the comma between the two denominations : 'SRV1SRV2', which do not give me any way of breaking it into different connection names.

I would like a solution for that issue once this way of setting up connections is documented by Oracle.

Even though the GetServerList method does not return the correct tnsnames server list, the TSession. Connect method works perfectly with any of the two names defined on this way.

Thanks a lot.

Eng. Jayme Jeffman Filho ( Mr )
DBA

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 13 Oct 2009 08:13

This problem is solved in the latest ODAC version.

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

Re: get tnsnames alias list?

Post by sinys » Tue 23 Jul 2013 21:13

How I can get information in form "IP:port\sid" (example: 127.0.0.1:1521\orcl)?
Can I get IP:port information from tnanames using ODAC?

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

Re: get tnsnames alias list?

Post by AlexP » Wed 24 Jul 2013 08:27

Hello,

Using ODAC, you won't be able to retrieve parameters specified in the tnsnames.ora file, connection string parsing is performed in the OCI.dll library. If you need to retrieve this information, you should implement your own parser for the tnsnames.ora file

Post Reply