单束式驱动程序介于应用程序和数据库之间,像中介驱动程序一样数据提供一个统一的数据访问方式。当用户进行数据库操作时,应用程序传递一个ODBC 函数调用给ODBC 驱动程序管理器,由ODBC API 判断该调用是由它直接处理并将结果返回还是送交驱动程序执行并将结果返回。由上可见,单束式驱动程序本身是一个数据库引擎,由它直接可完成对数据库的操作,尽管该数据库可能位于网络的任何地方。
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))