Oracle OLEDB常見的connection string如下:
"Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=Username;Password=asdasd;"
其中,User Id可以寫system,可以登陸成功。但如果寫成sys,會有錯誤訊息:sys必須以sysdba方式登陸。但是Oracle OLEDB並不支援下列方式:
User Id=sys as sysdba;
原因是OLE DB標準本來就不支援這種方式登陸。
如果硬要sys以sysdba方式登陸,只能使用ODBC。
相關資料如下(我試過oracle 10g,依然不行):
Doc ID: Note:276719.1
Subject: Is It Possible to Connect to Oracle as SYSDBA From ADO
Type: PROBLEM
Status: PUBLISHED
Content Type: TEXT/X-HTML
Creation Date: 18-JUN-2004
Last Revision Date: 03-AUG-2005
Applies to:
Oracle Provider for OLE DB - Version: 9.2.0.1
Oracle ODBC Driver - Version: 8.1.7.0 to 10.1.0.4
Microsoft Windows 2000
Microsoft Windows XP
Microsoft Windows Server 2003
Microsoft Windows (32-bit)
Symptoms
Unable to connect as SYSDBA from ADO applications.
Cause
Using the Microsoft OLEDB Provider to connect as SYSDBA
According to Bug 2114052, it is not possible, per the OLE DB specification,
to connect to a database with the "AS SYSDBA" syntax. This will not work
with Oracle OLE DB Provider either.