LDAP lookup using ODP.NET, Managed Driver Beta (Oracle.ManagedDataAccess.dll) fails in C# application

六眼飞鱼酱① 提交于 2019-12-11 04:37:11

问题


I'm using ODP.NET, Managed Driver Beta (Oracle.ManagedDataAccess.dll) in my C# application to access an Oracle database. This is to replace using the native version of ODP.NET in order to remove all the local dependencies on Oracle Client 10g/11g/etc. so that this needn't have to be installed locally. This is a solution I found here.

This is my C# code:

new OracleConnection("Data Source=ABCDEFG1;User Id=myuserid;Password=mypassword;").Open();

This line is reached and the OracleConnection object is created successfully thereby suggesting all dependencies are loaded successfully. However, it throws an OracleException on the call to Open(). The error message is:

Network Transport: Unable to resolve connect hostname

My organisation performs hostname lookups using LDAP and this is done via the ORA files using DIRECTORY_SERVER setting. However, I'm having difficulty getting it to do this using the managed version of ODP.NET. The ORA files are stored in C:\Apps\oracle\network\admin.

tnsping on my data source ('ABCDEFG1') works fine. So, I used the output of tnsping and added an entry for ABCDEFG1 in tnsnames.ora using this output. My application then connected successfully. So, I know that it is definitely finding and using the ORA files, but, for some reason, it won't perform the LDAP lookup that non-managed ODP.NET (in other applications) uses.

Is anyone who's used this new managed ODP.NET aware of this problem or what I might be doing wrong?


回答1:


I asked the same question on the Oracle forums, and someone there came up with an answer. It appears that managed ODP.NET doesn’t support LDAP and this is in its release notes.

I do have a further question following on from this, though, and would be happy if anyone could help me further by answering that one instead.

Many thanks.



来源:https://stackoverflow.com/questions/14561952/ldap-lookup-using-odp-net-managed-driver-beta-oracle-manageddataaccess-dll-fa

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