單束式驅動程序介于應用程序和數(shù)據(jù)庫之間,像中介驅動程序一樣數(shù)據(jù)提供一個統(tǒng)一的數(shù)據(jù)訪問方式。當用戶進行數(shù)據(jù)庫操作時,應用程序傳遞一個ODBC 函數(shù)調用給ODBC 驅動程序管理器,由ODBC API 判斷該調用是由它直接處理并將結果返回還是送交驅動程序執(zhí)行并將結果返回。由上可見,單束式驅動程序本身是一個數(shù)據(jù)庫引擎,由它直接可完成對數(shù)據(jù)庫的操作,盡管該數(shù)據(jù)庫可能位于網(wǎng)絡的任何地方。
u ODBC 1. Standard Security: "Driver={SQLServer};Server=Aron1;Database=pubs;Uid=sa;Pwd=asdasd;" 2. Trusted connection: "Driver={SQLServer};Server=Aron1;Database=pubs;Trusted_Connection=yes;" 3. Prompt for username and password: oConn.Properties("Prompt")= adPromptAlways oConn.Open"Driver={SQL Server};Server=Aron1;DataBase=pubs;"
u OLE DB, OleDbConnection (.NET)
1. Standard Security: "Provider=sqloledb;DataSource=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;" 2. Trusted Connection: "Provider=sqloledb;DataSource=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;" (useserverName\instanceName as Data Source to use an specifik SQLServer instance,only SQLServer2000) 3. Prompt for username and password: oConn.Provider= "sqloledb" oConn.Properties("Prompt")= adPromptAlways oConn.Open"Data Source=Aron1;Initial Catalog=pubs;" 4. Connect via an IP address: "Provider=sqloledb;DataSource=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;UserID=sa;Password=asdasd;" (DBMSSOCN=TCP/IPinstead of Named Pipes, at the end of the Data Source is the port to use (1433is the default))
u SqlConnection (.NET)
1. Standard Security: "DataSource=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;" - or - "Server=Aron1;Database=pubs;UserID=sa;Password=asdasd;Trusted_Connection=False" (bothconnection strings produces the same result) 2. Trusted Connection: "DataSource=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;" - or - "Server=Aron1;Database=pubs;Trusted_Connection=True;" (bothconnection strings produces the same result) (useserverName\instanceName as Data Source to use an specifik SQLServer instance,only SQLServer2000) 3. Connect via an IP address: "DataSource=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=pubs;UserID=sa;Password=asdasd;" (DBMSSOCN=TCP/IPinstead of Named Pipes, at the end of the Data Source is the port to use (1433is the default))