ODP.NET Managed tnsnames.ora IFILE references

柔情痞子 提交于 2019-12-11 07:18:52

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/26663801/odp-net-managed-tnsnames-ora-ifile-references

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!