Oracle 的 OID 服务、Oracle.DataAccess 和连接字符串
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4629219/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle's OID Service, Oracle.DataAccess and connection strings
提问by Scott Ross
I am looking to understand how to implement an OID connection string in .Net using the Oracle.DataAccess.dll .
我希望了解如何使用 Oracle.DataAccess.dll 在 .Net 中实现 OID 连接字符串。
The OID connection string is in this format: ldap://servname:389/instance,cn=OracleContext
OID 连接字符串格式如下:ldap://servname:389/instance,cn=OracleContext
When I use this as my datasource, I receive this error: ..is an invalid connection string attribute
当我使用它作为我的数据源时,我收到这个错误:..is an invalid connection string attribute
What is the format to connect to Oracle's OID?
连接到 Oracle 的 OID 的格式是什么?
Thank you, Scott
谢谢你,斯科特
采纳答案by Scott Ross
After being diverted for almost two years, I came back to this issue and sort of have a solution.
在被转移了近两年之后,我又回到了这个问题上,并有一个解决方案。
First, Oracle notes that ldap support is not supported in the managed library for oracle. Boo. http://www.oracle.com/technetwork/database/windows/downloads/odpmbetainstall-1696475.html
首先,Oracle 指出 oracle 的托管库不支持 ldap 支持。嘘。http://www.oracle.com/technetwork/database/windows/downloads/odpmbetainstall-1696475.html
Second, using this thread: How do I query LDAP from C# to resolve Oracle TNS hostname while using managed ODP.NET?
其次,使用此线程: 如何在使用托管 ODP.NET 时从 C# 查询 LDAP 以解析 Oracle TNS 主机名?
I was able to rig up an ldap lookup for the tns connection string, and ultimately pass that on to nhibernate.
我能够为 tns 连接字符串设置 ldap 查找,并最终将其传递给 nhibernate。
I hope the Oracle eventually supports ldap.
我希望 Oracle 最终支持 ldap。
回答by Codo
Oracle's idea is to configure the LDAP server (OID in your case) in the LDAP.ORA file in the TNS Admin directory (usually $ORACLE_HOME/network/admin). There you have something like:
Oracle 的想法是在 TNS Admin 目录(通常为 $ORACLE_HOME/network/admin)的 LDAP.ORA 文件中配置 LDAP 服务器(在您的情况下为 OID)。你有这样的事情:
DIRECTORY_SERVERS = (servname:389)
DEFAULT_ADMIN_CONTEXT = "dc=company,dc=com"
DIRECTORY_SERVER_TYPE = OID
You might also need to adapt the SQLNET.ORA file:
您可能还需要修改 SQLNET.ORA 文件:
NAMES.DIRECTORY_PATH= (LDAP, TNSNAMES)
Then your connection string is just:
那么你的连接字符串就是:
Data Source=instance; User ID=scott; Password=tiger
(or even without user ID and password).
(甚至没有用户名和密码)。
Update:
更新:
If you cannot change the TNS Admin directory, the only option I know of is to use connection strings containing all the details (server name, port, SID or service name). There are three formats:
如果您无法更改 TNS Admin 目录,我所知道的唯一选择是使用包含所有详细信息(服务器名称、端口、SID 或服务名称)的连接字符串。共有三种格式:
TNS syntax:
TNS 语法:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=serername)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=instanceSID))); User ID=scott; Password=tiger
EZ Connect with a service name (note the single slashe between the server name and the service name):
带有服务名称的 EZ Connect(注意服务器名称和服务名称之间的单斜线):
Data Source=//servername:1521/servicename; User ID=scott; Password=tiger
EZ Connect with an SID (note the double slashes between the server name and the SID):
带有 SID 的 EZ Connect(注意服务器名称和 SID 之间的双斜线):
Data Source=servername:1521//instanceSID; User ID=scott; Password=tiger