Data Access and Transactions |
A provider is a component that manages access to a data source. The Access and SQL Server providers are only two of the OLE DB providers available with ADO. In most cases, you don’t have to specify the OLE DB provider; you can just use the default ODBC driver. However, not all OLE DB providers are alike; some connect to nonstandard data sources and some have specialized functionality. Microsoft continues to update and add to the following list in Table 7.2 of OLE DB providers installed with ADO 2.0:
Table 7.2 Common OLE DB Providers
Driver | Description |
MSDASQL | OLE DB provider for ODBC. Connects to existing ODBC data sources, either with a System DSN or from connection string parameters. This is the default, if no provider is specified. |
Microsoft.Jet.OLEDB.3.51 | Access data provider. Connects to Jet databases. |
SQLOLEDB | SQL Server OLE DB data provider. |
MSDAORA | OLE DB provider for Oracle. |
MSIDXS | Provider for Microsoft® Indexing Service. |
ADSDSOObject | Microsoft® Active Directory™ Services provider. |
SNAOLEDB | OLE DB provider for Microsoft® SNA Server (requires SNA Server Client). |
MSDataShape | Hierarchical recordset service provider. |
MSPersist | Persisted recordset (local storage) service provider. |
MS Remote | RDS disconnected recordset service provider. |
MSDAOSP | Simple OLE DB provider. This provider can be used as the basis of custom providers that you create. |
Choosing a data provider is as simple as setting the Provider property of the Connection object. The following ASP example uses a sample provider (“sampprov”) to create a Recordset object from a Comma Separated Values (CSV) file:
Set cn = Server.CreateObject("ADODB.Connection")
cn.Provider = "sampprov"
cn.Open "Data Source=C:\oledbsdk\samples\sampclnt"
Set rs = cn.Execute("customer.csv")
Note The “sampprov” provider is shipped with OLE DB SDK 1.5 and later releases.