Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I query LDAP from C# to resolve Oracle TNS hostname while using managed ODP.NET?
    text
    copied!<p>Further to my previous <a href="https://stackoverflow.com/questions/14561952">Question</a>, which I managed to answer myself with <a href="https://forums.oracle.com/forums/message.jspa?messageID=10817895#10817895" rel="nofollow noreferrer">help from the Oracle forums</a>, I now have another issue which follows on from the earlier one (provided for background).</p> <p>I wish to query LDAP directly from my C# code to perform an LDAP lookup of an Oracle TNS hostname in order to get the connection string. This is normally stored in <strong>tnsnames.ora</strong>, and my organisation uses LDAP (via <strong>ldap.ora</strong>) to resolve hostnames from an LDAP server using Active Directory.</p> <p>However, I am using <a href="http://www.oracle.com/technetwork/topics/dotnet/index-085163.html" rel="nofollow noreferrer">ODP.NET, Managed Driver Beta</a> (<strong>Oracle.ManagedDataAccess.dll</strong>) in my C# application which doesn't support LDAP as mentioned in the <a href="http://www.oracle.com/technetwork/database/windows/downloads/odpmbetainstall-1696475.html" rel="nofollow noreferrer">release notes</a> pointed to by the <a href="https://forums.oracle.com/forums/message.jspa?messageID=10817895#10817895" rel="nofollow noreferrer">Oracle forum reply</a> I mentioned earlier. This is why I wish to query LDAP directly from C#.</p> <p>I found a way to do this <a href="https://stackoverflow.com/questions/6452531">here</a> using <code>DirectoryEntry</code> and <code>DirectorySearcher</code>, but I have no idea what to put as the parameters to <code>DirectorySearcher</code>. I have access to <strong>ldap.ora</strong> which is in the following format:</p> <blockquote> <p># LDAP.ORA Configuration<br> # Generated by Oracle configuration tools.<br> DEFAULT_ADMIN_CONTEXT = "dc=xx,dc=mycompany,dc=com"<br> DIRECTORY_SERVERS = (ldap_server1.mycompany.com:389:636,ldap_server2.mycompany.com:389:636, ...) DIRECTORY_SERVER_TYPE = OID</p> </blockquote> <p>But, how do I map this to setting up the LDAP query in my C# code?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload