Visual Studio 2015 添加连接对话框未将 LDAP 作为连接类型
我正在尝试在 Visual Studio 2015 中使用服务器资源管理器连接到 oracle 数据库.每次我尝试通过添加连接对话框创建新连接时,连接类型:"前面的下拉菜单(在对话框)只给我 TNS 和 EZConnect 选项.没有列出通过 LDAP 连接到 Oracle 的选项.我被要求仅通过 LDAP 进行连接(没有 TNS 或 EZCONnect).
I'm trying to connect to oracle database using server explorer in visual studio 2015. Every time I try to create a new connection through Add Connection dialog box, the drop down menu in front of "Connection Type:" (on the dialog box) only gives me TNS and EZConnect options. No option is listed for connecting to Oracle through LDAP. I have been asked to connect only through LDAP (no TNS or EZCOnnect).
我的sqlnet.ora文件有这些内容
My sqlnet.ora file has these contents
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME, LDAP)
在里面.
而ldap.ora有这些内容
And ldap.ora has these contents
DEFAULT_ADMIN_CONTEXT = "dc=something1,dc=something2,dc=com"
DIRECTORY_SERVERS= (x.y.net:somenumber:somenumber,a.b.c.net:somenumber:somenumber,p.q.r.net:somenumber:somenumber)
DIRECTORY_SERVER_TYPE = OID
哦,实际上我将这些文件复制到了 tns.ora 文件默认所在的位置(如果我在添加连接"对话框中选择 tns 作为连接类型,那么我就会知道 tns 文件的默认位置).
Oh actually I copied these files over to where tns.ora file sits by default (if I select tns as connection type in Add Connection dialog box that's when I come to know about tns file's default location).
我不确定是否需要通过在 web.config 文件或其他内容中添加某种配置来通过 LDAP 连接到 Oracle.如果是这样,那么我如何连接到 oracle(使用服务器资源管理器,请记住不要使用 TNS 或 EZConnect)并使用 Visual Studio UI 在数据库中创建表.除了 Visual Studio UI(UI 用于在我们使用服务器资源管理器与数据库建立连接后创建所有数据库对象)之外,我不应该使用任何其他工具来创建表.
I'm not sure do I need to connect to Oracle through LDAP by adding some kind of configuration in web.config file or something. And if so then how can I connect to oracle (using server explorer, remember no TNS or EZConnect) and create tables in the database using Visual Studio UI. I'm not supposed to use any other tools for creating tables other than Visual Studio UI (UI which is meant for creating all database objects after we establish a connection to the database using server explorer).
我完全困惑的另一件事是在数据源"下的对话框顶部:我看到它写着Oracle 数据库(ODP.NET,托管驱动程序)"和右侧的更改按钮它的原因.Visual Studio 怎么知道 odp.net 驱动程序在机器上的位置(因此在单击更改按钮时在下拉菜单中显示它).但是我安装和未安装 odp.net 无人管理和托管驱动程序(均为 32和 64 位版本)在我打开添加连接"对话框的项目中多次.即使我卸载了所有版本的非托管/托管驱动程序并单击更改按钮,我仍然可以看到 Oracle 数据库(ODP.NET, 托管驱动程序)在下拉菜单中,这怎么可能,因为所有 odp.net 托管或非托管驱动程序都已卸载.
And the other thing which I'm totally confused about is that up top on the dialog box under "Data Source:" I see it's written "Oracle Database (ODP.NET, Managed Driver)" and a change button to right of it.How come Visual Studio knows where the odp.net driver is lying on the machine (hence shows it in a drop down menu when change button is clicked).However I installed and uninsatlled odp.net unamanged and managed drivers (both 32 and 64 bit versions) many a times in the project that I have opened the Add Connection dialog box in. Even when I uninstalled all the versions of unmanaged/managed drivers and clicked on the change button I could still see Oracle Database (ODP.NET, Managed Driver) in the drop down, how is that possible since all the odp.net managed or unmanaged drivers has been uninstalled.
让我了解这一切变得很麻烦.任何帮助将不胜感激.
It's getting cumbersome to get my head around all this. Any help will be highly appreciated.
注意:我在 Visual Studio 中使用 nuget 包管理器控制台安装和卸载了 odp.net 驱动程序.
Note: I installed and uninstalled odp.net drivers using nuget package manager console in Visual Studio.
推荐答案
我假设 TNS
和 EZConnect
只是定义了类型连接字符串,但它没有告诉你如何解析您的 TNS 名称.它可以通过 tnsnames.ora
文件或 LDAP 服务器解析.如今,ONAMES
已不再使用.
I assume TNS
and EZConnect
just defines the type connection string but it does not tell you how to resolve the your TNS name. It can be resolved by tnsnames.ora
file or by LDAP server. Nowadays, ONAMES
is not used anymore.
您是否定义了环境变量 TNS_ADMIN
?ODP.NET 托管驱动程序不读取通常定义 TNS_ADMIN
的注册表.
Do you have an environment variable TNS_ADMIN
defined? ODP.NET Managed Driver does not read the registry where TNS_ADMIN
is usually defined.
使用工具 gacutil.exe
检查您的 GAC(全局程序集缓存)是否看到任何 Oracle.ManagedDataAccess.dll
.也许卸载程序没有从那里删除它.
Check you GAC (Global Assembly Cache) with tool gacutil.exe
is you see any Oracle.ManagedDataAccess.dll
. Perhaps the Uninstaller did not remove it from there.
您是否尝试通过代码连接到数据库,而不是单击对话框?
Did you try to connect to the database by code, instead of clicking dialog boxes?
相关文章