Page 1 of 1
get tnsnames alias list?
Posted: Fri 21 Aug 2009 14:48
by albourgz
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
Posted: Tue 25 Aug 2009 08:31
by Plash
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;
BUG on TOraServerEnumerator.GetServerList method
Posted: Mon 12 Oct 2009 17:06
by jjeffman

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
Posted: Tue 13 Oct 2009 08:13
by Plash
This problem is solved in the latest ODAC version.
Re: get tnsnames alias list?
Posted: Tue 23 Jul 2013 21:13
by sinys
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?
Re: get tnsnames alias list?
Posted: Wed 24 Jul 2013 08:27
by AlexP
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