Search code examples
.netodp.nettnsnamesodp.net-managedora-12154

ODP.NET Managed tnsnames.ora IFILE references


Does Managed ODP.NET x64 12.1.0.2 tnsname.ora support using IFILE?? I cannot get it to work.

For example, with the normal "thick client" unmanaged Oracle client that I have had installed for years, I used to have my tnsnames.ora file with one line in it:

IFILE=C:\OracleDataSources\tnsnames.MAIN

And then the C:\OracleDataSources\tnsnames.MAIN file contains IFILE references to config files that contain the actual data source definitions for each of the other Oracle instances within our organization. This helps to keep our config files centralized and separate from install files, and works with no errors when using the full Oracle client install.

Now I am working on upgrading some code that used the older/deprecated System.Data.OracleClient references to use ODP.NET managed client. If I try to use IFILE references with the managed ODP.NET libraries, I get the following error:

ORA-12154: TNS:could not resolve the connect identifier specified

During troubleshooting, I confirmed that no data sources are being retrieved from tnsnames.ora by using the Oracle.ManagedDataAccess.Client.OracleDataSourceEnumerator.GetDataSources() method (http://docs.oracle.com/html/B28089_01/OracleDataSourceEnumeratorClass.htm#CBAHABEH ), which will return a list of all data sources enumerated from tnsnames.ora.

When only IFILE references are used in tnsnames.ora, I get 0 results from GetDataSources. If I manually add the data source aliases directly to the tnsnames.ora file in the folder specified in web.config TNS_ADMIN settings (instead of using IFILE references), then the data sources are returned from GetDataSources correctly, and I can connect to the data source successfully using ODP.NET.

Is there any way to use IFILE tns names references with ODP.NET?


Solution

  • Sorry, IFILE is neither supported in the config file nor in TNSNAMES.ORA when using ODP.NET, Managed Driver.

    Perhaps the TNS_ADMIN config file entry will achieve the same thing for you.