TNS-Alias / actual content

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Yahia
Posts: 26
Joined: Tue 25 Oct 2011 09:30

TNS-Alias / actual content

Post by Yahia » Thu 28 Mar 2019 06:45

Hi,

I can get the list of TNS aliases (GetServerList)... BUT:
is there a way to get the content from TNSNAMES.ORA which is associated with a specific TNS-Alias?

Best Regards
Yahia

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: TNS-Alias / actual content

Post by Pinturiccio » Mon 01 Apr 2019 16:51

dotConnect for Oracle does not have a feature to get TNS-Alias content. You can get the tnsnames.ora content of desired home and parse it yourself. You can get the content in the following way:

Code: Select all

OracleHome home = OracleConnection.Homes["Home_name"];
var path = home.Path + @"\network\admin\tnsnames.ora";
String content = File.ReadAllText(path);
Where you need to replace "Home_name" with the actual name of the desired home. Please also note that OracleConnection.Homes returns only homes of the same bitness as your application.

Post Reply