ODP.NET托管的tnsnames.ora IFILE引用 [英] ODP.NET Managed tnsnames.ora IFILE references

查看:154
本文介绍了ODP.NET托管的tnsnames.ora IFILE引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

受管理的ODP.NET x64 12.1.0.2 tnsname.ora是否支持使用IFILE?我无法使它正常工作.

例如,对于我已经安装了多年的普通加厚客户端"非托管Oracle客户端,我曾经在tnsnames.ora文件中添加了一行:

IFILE = C:\ OracleDataSources \ tnsnames.MAIN

然后C:\ OracleDataSources \ tnsnames.MAIN文件包含对配置文件的IFILE引用,这些文件包含我们组织中每个其他Oracle实例的实际数据源定义.这有助于使我们的配置文件集中并与安装文件分开,并且在使用完整的Oracle客户端安装时不会出现错误.

现在,我正在升级一些使用较旧/已弃用的System.Data.OracleClient引用的代码,以使用ODP.NET托管客户端.如果我尝试将IFILE引用与托管ODP.NET库一起使用,则会出现以下错误:

ORA-12154:TNS:无法解析指定的连接标识符

在进行故障排除期间,我确认使用Oracle.ManagedDataAccess.Client.OracleDataSourceEnumerator.GetDataSources()方法没有从tnsnames.ora检索任何数据源( http://docs.oracle.com/html/B28089_01/OracleDataSourceEnumeratorClass.htm#CBAHABEH ),这将返回从tnsnames.ora枚举的所有数据源的列表.

当在tnsnames.ora中仅使用IFILE引用时,我从GetDataSources中得到0个结果.如果我将数据源别名直接手动添加到web.config TNS_ADMIN设置中指定的文件夹中的tnsnames.ora文件中(而不是使用IFILE引用),那么数据源将从GetDataSources正确返回,并且我可以连接到ODP.NET成功访问数据源.

是否可以在ODP.NET中使用IFILE tns名称引用?

解决方案

抱歉,使用ODP.NET(托管驱动程序)时,配置文件和TNSNAMES.ORA都不支持IFILE.

也许TNS_ADMIN配置文件条目将为您实现相同的目的.

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?

解决方案

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.

这篇关于ODP.NET托管的tnsnames.ora IFILE引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆