• <bdo id='1UZzG'></bdo><ul id='1UZzG'></ul>
  • <small id='1UZzG'></small><noframes id='1UZzG'>

    <legend id='1UZzG'><style id='1UZzG'><dir id='1UZzG'><q id='1UZzG'></q></dir></style></legend>

    <i id='1UZzG'><tr id='1UZzG'><dt id='1UZzG'><q id='1UZzG'><span id='1UZzG'><b id='1UZzG'><form id='1UZzG'><ins id='1UZzG'></ins><ul id='1UZzG'></ul><sub id='1UZzG'></sub></form><legend id='1UZzG'></legend><bdo id='1UZzG'><pre id='1UZzG'><center id='1UZzG'></center></pre></bdo></b><th id='1UZzG'></th></span></q></dt></tr></i><div id='1UZzG'><tfoot id='1UZzG'></tfoot><dl id='1UZzG'><fieldset id='1UZzG'></fieldset></dl></div>

      1. <tfoot id='1UZzG'></tfoot>

      2. 如何在使用托管 ODP.NET 时从 C# 查询 LDAP 以解析 Oracle TNS 主机名?

        时间:2023-10-24

        <small id='uUStq'></small><noframes id='uUStq'>

          <tbody id='uUStq'></tbody>

          <bdo id='uUStq'></bdo><ul id='uUStq'></ul>

              • <tfoot id='uUStq'></tfoot>
                <legend id='uUStq'><style id='uUStq'><dir id='uUStq'><q id='uUStq'></q></dir></style></legend>
                1. <i id='uUStq'><tr id='uUStq'><dt id='uUStq'><q id='uUStq'><span id='uUStq'><b id='uUStq'><form id='uUStq'><ins id='uUStq'></ins><ul id='uUStq'></ul><sub id='uUStq'></sub></form><legend id='uUStq'></legend><bdo id='uUStq'><pre id='uUStq'><center id='uUStq'></center></pre></bdo></b><th id='uUStq'></th></span></q></dt></tr></i><div id='uUStq'><tfoot id='uUStq'></tfoot><dl id='uUStq'><fieldset id='uUStq'></fieldset></dl></div>

                  本文介绍了如何在使用托管 ODP.NET 时从 C# 查询 LDAP 以解析 Oracle TNS 主机名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我之前的 问题 的基础上,我设法用 来自 Oracle 论坛的帮助,我现在遇到了另一个问题,这是上一个问题的后续问题(提供背景信息).

                  Further to my previous Question, which I managed to answer myself with help from the Oracle forums, I now have another issue which follows on from the earlier one (provided for background).

                  我希望直接从我的 C# 代码中查询 LDAP,以执行 Oracle TNS 主机名的 LDAP 查找,以获取连接字符串.这通常存储在 tnsnames.ora 中,我的组织使用 LDAP(通过 ldap.ora)从使用 Active Directory 的 LDAP 服务器解析主机名.

                  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 tnsnames.ora, and my organisation uses LDAP (via ldap.ora) to resolve hostnames from an LDAP server using Active Directory.

                  但是,我使用的是 ODP.NET,托管驱动程序测试版 (Oracle.ManagedDataAccess.dll) 在我的 C# 应用程序中,它不支持 发行说明"nofollow noreferrer">Oracle 论坛回复 前面提到过.这就是为什么我希望直接从 C# 中查询 LDAP.

                  However, I am using ODP.NET, Managed Driver Beta (Oracle.ManagedDataAccess.dll) in my C# application which doesn't support LDAP as mentioned in the release notes pointed to by the Oracle forum reply I mentioned earlier. This is why I wish to query LDAP directly from C#.

                  我在这里找到了一种方法,使用 DirectoryEntryDirectorySearcher,但我不知道将什么作为参数放入 DirectorySearcher.我可以访问 ldap.ora,格式如下:

                  I found a way to do this here using DirectoryEntry and DirectorySearcher, but I have no idea what to put as the parameters to DirectorySearcher. I have access to ldap.ora which is in the following format:

                  # LDAP.ORA 配置
                  # 由 Oracle 配置工具生成.
                  DEFAULT_ADMIN_CONTEXT = "dc=xx,dc=mycompany,dc=com"
                  DIRECTORY_SERVERS = (ldap_server1.mycompany.com:389:636,ldap_server2.mycompany.com:389:636, ...) DIRECTORY_SERVER_TYPE = OID

                  # LDAP.ORA Configuration
                  # Generated by Oracle configuration tools.
                  DEFAULT_ADMIN_CONTEXT = "dc=xx,dc=mycompany,dc=com"
                  DIRECTORY_SERVERS = (ldap_server1.mycompany.com:389:636,ldap_server2.mycompany.com:389:636, ...) DIRECTORY_SERVER_TYPE = OID

                  但是,如何将其映射到在我的 C# 代码中设置 LDAP 查询?

                  But, how do I map this to setting up the LDAP query in my C# code?

                  推荐答案

                  根据我在 使用 OpenLDAP 进行 Oracle 数据库名称解析,代码应如下所示:

                  Judging by what I found in Oracle Database Name Resolution with OpenLDAP, the code should look something like this:

                  string directoryServer = "ldap_server1.mycompany.com:389";
                  string defaultAdminContext = "dc=xx,dc=mycompany,dc=com";
                  string oracleHostEntryPath = string.Format("LDAP://{0}/cn=OracleContext,{1}", directoryServer, defaultAdminContext);
                  
                  var directoryEntry = new DirectoryEntry(oracleHostEntryPath) {AuthenticationType = AuthenticationTypes.None};
                  var directorySearcher = new DirectorySearcher(directoryEntry, "(&(objectclass=orclNetService)(cn=ABCDEFG1))", new[] { "orclnetdescstring" }, SearchScope.Subtree);
                  
                  string oracleNetDescription = Encoding.Default.GetString(des.FindOne().Properties["orclnetdescstring"][0] as byte[]);
                  

                  这篇关于如何在使用托管 ODP.NET 时从 C# 查询 LDAP 以解析 Oracle TNS 主机名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:IIS 抱怨使用 LDAP 身份验证的身份模拟 下一篇:将 LDAP 中的 WhenChanged 属性(通用时间)转换为 C# 中的 DateTime

                  相关文章

                  1. <i id='zMcQ3'><tr id='zMcQ3'><dt id='zMcQ3'><q id='zMcQ3'><span id='zMcQ3'><b id='zMcQ3'><form id='zMcQ3'><ins id='zMcQ3'></ins><ul id='zMcQ3'></ul><sub id='zMcQ3'></sub></form><legend id='zMcQ3'></legend><bdo id='zMcQ3'><pre id='zMcQ3'><center id='zMcQ3'></center></pre></bdo></b><th id='zMcQ3'></th></span></q></dt></tr></i><div id='zMcQ3'><tfoot id='zMcQ3'></tfoot><dl id='zMcQ3'><fieldset id='zMcQ3'></fieldset></dl></div>

                    <tfoot id='zMcQ3'></tfoot>
                  2. <small id='zMcQ3'></small><noframes id='zMcQ3'>

                    • <bdo id='zMcQ3'></bdo><ul id='zMcQ3'></ul>

                    1. <legend id='zMcQ3'><style id='zMcQ3'><dir id='zMcQ3'><q id='zMcQ3'></q></dir></style></legend>