6. OLE DB Provider for DB2 For TCP/IP connections (Microsoft)

oConn.Open = "Provider=DB2OLEDB;" & _
"Network Transport Library=TCPIP;" & _
"Network Address=xxx.xxx.xxx.xxx;" & _
"Initial Catalog=MyCatalog;" & _
"Package Collection=MyPackageCollection;" & _
"Default Schema=MySchema;" & _
"User ID=MyUsername;" & _
"Password=MyPassword"

For APPC connections

oConn.Open = "Provider=DB2OLEDB;" & _
"APPC Local LU Alias=MyLocalLUAlias;" & _
"APPC Remote LU Alias=MyRemoteLUAlias;" & _
"Initial Catalog=MyCatalog;" & _
"Package Collection=MyPackageCollection;" & _
"Default Schema=MySchema;" & _
"User ID=MyUsername;" & _
"Password=MyPassword"

More information, see ConnectionString Property, and Q218590
View Microsoft KB articles related to OLE DB Provider for DB2.

7. OLE DB Provider for DTS Packages
The Microsoft OLE DB Provider for DTS Packages is a read-only provider that exposes Data Transformation Services Package Data Source Objects.

oConn.Open = "Provider=DTSPackageDSO;" & _
"Data Source=mydatasource"

For more information, see OLE DB Providers Tested with SQL Server

8. OLE DB Provider for Exchange
oConn.Provider = "EXOLEDB.DataSource"
oConn.Open = "http://myServerName/myVirtualRootName"

More information, see Exchange OLE DB Provider, Messaging, Calendaring, Contacts, and Exchange using ADO objects

9. OLE DB Provider for Excel
Currently Excel does not have an OLE DB Provider.
However, you can use the ODBC Driver for Excel or use the OLE DB Provider for JET to read and write data in an Excel workbook.

OLE DB Provider for Index Server
oConn.Open "Provider=MSIDXS;" & _
"Data source=MyCatalog"

For more information, see: Microsoft OLE DB Provider for Microsoft Indexing Service

10. OLE DB Provider for Internet Publishing
oConn.Open "Provider=MSDAIPP.DSO;" & _
"Data Source=http://mywebsite/myDir;" & _
"User Id=myUsername;" & _
"Password=myPassword"
' Or

oConn.Open "URL=http://mywebsite/myDir;" & _
"User Id=myUsername;" & _
"Password=myPassword"

For more information, see: Microsoft OLE DB Provider for Internet Publishing and Q245359

11. OLE DB Provider for Microsoft Jet
For standard security

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="

If using a Workgroup (System Database):

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:System Database=MySystem.mdw", _
"myUsername", "myPassword"

Note, remember to convert both the MDB and the MDW to the 4.0 database format when using the 4.0 OLE DB Provider.

If MDB has a database password:

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mydb.mdb;" & _
"Jet OLEDB:Database Password=MyDbPassword", _
"myUsername", "myPassword"

If want to open up the MDB exclusively:

oConn.Mode = adModeShareExclusive
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\myDb.mdb;" & _
"User Id=admin;" & _
"Password="

If MDB is located on a network share:

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\\myServer\myShare\myPath\myDb.mdb"

If MDB is located on a remote machine:

- Or use an XML Web Service via SOAP Toolkit or ASP.NET
- Or upgrade to SQL Server and use an IP connection string
- Or use an ADO URL with a remote ASP web page
- Or use a MS Remote or RDS connection string

If you don't know the path to the MDB (using ASP):

<% ' ASP server-side code
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data
Source=" & Server.MapPath(".") & "\myDb.mdb;"
& _ "User Id=admin;" & _ "Password=" %>

This assumes the MDB is in the same directory where the ASP page is running. Also make sure this directory has Write permissions for the user account.


If you don't know the path to the MDB (using VB):

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\myDb.mdb;" & _
"User Id=admin;" & _
"Password="

This assumes the MDB is in the same directory where the application is running.

For more information, see: OLE DB Provider for Microsoft Jet, Q191754, and Q225048
Note: Microsoft.Jet.OLEDB.3.51 only gets installed by MDAC 2.0. Q197902
Note: MDAC 2.6 and 2.7 do not contain any of the JET components. Q271908 and Q239114

You can also open an Excel Spreadsheet using the JET OLE DB Provider

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\mySpreadsheet.xls;" & _
"Extended Properties=""Excel 8.0;HDR=Yes"""

Where "HDR=Yes" means that there is a header row in the cell range
(or named range), so the provider will not include the first row of the
selection into the recordset. If "HDR=No", then the provider will include
the first row of the cell range (or named ranged) into the recordset.

You can also open a Text file using the JET OLE DB Provider :

oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\somepath\;" & _
"Extended Properties=""text;HDR=Yes;FMT=Delimited"""
'Then open a recordset based on a select on the actual file

oRs.Open "Select * From MyTextFile.txt", oConn, _
adOpenStatic, adLockReadOnly, adCmdText

For more information, see: Q262537

12. OLE DB Provider for Microsoft Project
oConn.Open "Provider=Microsoft.Project.OLEDB.9.0;" & _
"Project Name=c:\somepath\myProject.mpp"

For more information, see: Microsoft Project 2000 OLE DB Provider Information

13. OLE DB Provider for mySQL
oConn.Open "Provider=MySQLProv;" & _
"Data Source=mySQLDB;" & _
"User Id=myUsername;" & _
"Password=myPassword"

For more information, see: API - OLE DB and Snippet

14. OLE DB Provider for ODBC Databases
WARNING: This OLE DB Provider is considered obsolete by Microsoft

0 komentar:

 
Top