問(wèn)題描述
我正在嘗試在 Visual Studio 2015 中使用服務(wù)器資源管理器連接到 oracle 數(shù)據(jù)庫(kù).每次我嘗試通過(guò)添加連接對(duì)話(huà)框創(chuàng)建新連接時(shí),連接類(lèi)型:"前面的下拉菜單(在對(duì)話(huà)框)只給我 TNS 和 EZConnect 選項(xiàng).沒(méi)有列出通過(guò) LDAP 連接到 Oracle 的選項(xiàng).我被要求僅通過(guò) LDAP 進(jìn)行連接(沒(méi)有 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文件有這些內(nèi)容
My sqlnet.ora file has these contents
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME, LDAP)
在里面.
而ldap.ora有這些內(nèi)容
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
哦,實(shí)際上我將這些文件復(fù)制到了 tns.ora 文件默認(rèn)所在的位置(如果我在添加連接"對(duì)話(huà)框中選擇 tns 作為連接類(lèi)型,那么我就會(huì)知道 tns 文件的默認(rèn)位置).
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).
我不確定是否需要通過(guò)在 web.config 文件或其他內(nèi)容中添加某種配置來(lái)通過(guò) LDAP 連接到 Oracle.如果是這樣,那么我如何連接到 oracle(使用服務(wù)器資源管理器,請(qǐng)記住不要使用 TNS 或 EZConnect)并使用 Visual Studio UI 在數(shù)據(jù)庫(kù)中創(chuàng)建表.除了 Visual Studio UI(UI 用于在我們使用服務(wù)器資源管理器與數(shù)據(jù)庫(kù)建立連接后創(chuàng)建所有數(shù)據(jù)庫(kù)對(duì)象)之外,我不應(yīng)該使用任何其他工具來(lái)創(chuàng)建表.
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).
我完全困惑的另一件事是在數(shù)據(jù)源"下的對(duì)話(huà)框頂部:我看到它寫(xiě)著Oracle 數(shù)據(jù)庫(kù)(ODP.NET,托管驅(qū)動(dòng)程序)"和右側(cè)的更改按鈕它的原因.Visual Studio 怎么知道 odp.net 驅(qū)動(dòng)程序在機(jī)器上的位置(因此在單擊更改按鈕時(shí)在下拉菜單中顯示它).但是我安裝和未安裝 odp.net 無(wú)人管理和托管驅(qū)動(dòng)程序(均為 32和 64 位版本)在我打開(kāi)添加連接"對(duì)話(huà)框的項(xiàng)目中多次.即使我卸載了所有版本的非托管/托管驅(qū)動(dòng)程序并單擊更改按鈕,我仍然可以看到 Oracle 數(shù)據(jù)庫(kù)(ODP.NET, 托管驅(qū)動(dòng)程序)在下拉菜單中,這怎么可能,因?yàn)樗?odp.net 托管或非托管驅(qū)動(dòng)程序都已卸載.
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 包管理器控制臺(tái)安裝和卸載了 odp.net 驅(qū)動(dòng)程序.
Note: I installed and uninstalled odp.net drivers using nuget package manager console in Visual Studio.
推薦答案
我假設(shè) TNS
和 EZConnect
只是定義了類(lèi)型連接字符串,但它沒(méi)有告訴你如何解析您的 TNS 名稱(chēng).它可以通過(guò) tnsnames.ora
文件或 LDAP 服務(wù)器解析.如今,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.
您是否定義了環(huán)境變量 TNS_ADMIN
?ODP.NET 托管驅(qū)動(dòng)程序不讀取通常定義 TNS_ADMIN
的注冊(cè)表.
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
.也許卸載程序沒(méi)有從那里刪除它.
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.
您是否嘗試通過(guò)代碼連接到數(shù)據(jù)庫(kù),而不是單擊對(duì)話(huà)框?
Did you try to connect to the database by code, instead of clicking dialog boxes?
這篇關(guān)于Visual Studio 2015 添加連接對(duì)話(huà)框未將 LDAP 作為連接類(lèi)型的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!