Επεξεργασία

Κοινή χρήση μέσω


Microsoft OLE DB Remoting Provider Overview

The Microsoft OLE DB Remoting Provider enables a local user on a client machine to invoke data providers on a remote machine. Specify the data provider parameters for the remote machine as you would if you were a local user on the remote machine. Then specify the parameters used by the Remoting Provider to access the remote machine. You can then access the remote machine as if you were a local user.

Important

Beginning with Windows 8 and Windows Server 2012, RDS server components are no longer included in the Windows operating system (see Windows 8 and Windows Server 2012 Compatibility Cookbook for more detail). RDS client components will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Applications that use RDS should migrate to WCF Data Service.

Provider Keyword

To invoke the OLE DB Remoting Provider, specify the following keyword and value in the connection string. (Note the blank space in the provider name.)

"Provider=MS Remote"

Additional Keywords

When this service provider is invoked, the following additional keywords are relevant.

Keyword Description
Data Source Specifies the name of the remote data source. It is passed to the OLE DB Remoting Provider for processing.

This keyword is equivalent to the RDS.DataControl object's Connect property.

Dynamic Properties

When this service provider is invoked, the following dynamic properties are added to the Connection object's Properties collection.

Dynamic Property Name Description
DFMode Indicates the DataFactory Mode. A string that specifies the desired version of the DataFactory object on the server. Set this property before opening a connection to request a particular version of the DataFactory. If the requested version is not available, an attempt will be made to use the preceding version. If there is no preceding version, an error will occur. If DFMode is less than the available version, an error will occur. This property is read-only after a connection is made.

Can be one of the following valid string values:

- "25"-Version 2.5 (Default)
- "21"-Version 2.1
- "20"-Version 2.0
- "15"-Version 1.5
Command Properties Indicates values that will be added to the string of command (rowset) properties sent to the server by the MS Remote provider. The default value for this string is vt_empty.
Current DFMode Indicates the actual version number of the DataFactory on the server. Check this property to see if the version requested in the DFMode property was honored.

Can be one of the following valid Long integer values:

- 25-Version 2.5 (Default)
- 21-Version 2.1
- 20-Version 2.0
- 15-Version 1.5

Adding "DFMode=20;" to your connection string when using the MSRemote provider can improve your server's performance when updating data. With this setting, the RDSServer.DataFactory object on the server uses a less resource-intensive mode. However, the following features are not available in this configuration:

- Using parameterized queries.
- Getting parameter or column information before calling the Execute method.
- Setting Transact Updates to True.
- Getting row status.
- Calling the Resync method.
- Refreshing (explicitly or automatically) via the Update Resync property.
- Setting Command or Recordset properties.
- Using adCmdTableDirect.
Handler Indicates the name of a server-side customization program (or handler) that extends the functionality of the RDSServer.DataFactory, and any parameters used by the handler, all separated by commas (","). A String value.
Internet Timeout Indicates the maximum number of milliseconds to wait for a request to travel to and from the server. (The default is 5 minutes.)
Remote Provider Indicates the name of the data provider to be used on the remote server.
Remote Server Indicates the server name and communication protocol to be used by this connection. This property is equivalent to the RDS.DataContro object Server property.
Transact Updates When set to True, this value indicates that when UpdateBatch is performed on the server, it will be done inside a transaction. The default value for this Boolean dynamic property is False.

You may also set writable dynamic properties by specifying their names as keywords in the connection string. For example, set the Internet Timeout dynamic property to five seconds by specifying:

Dim cn as New ADODB.Connection
cn.Open "Provider=MS Remote;Internet Timeout=5000"

You may also set or retrieve a dynamic property by specifying its name as the index to the Properties property. The following example shows how to get and print the current value of the Internet Timeout dynamic property, and then set a new value:

Debug.Print cn.Properties("Internet Timeout")
cn.Properties("Internet Timeout") = 5000

Remarks

In ADO 2.0, the OLE DB Remoting Provider could only be specified in the ActiveConnection parameter of the Recordset object Open method. Starting with ADO 2.1, the provider may also be specified in the ConnectionString parameter of the Connection object Open method.

The equivalent of the RDS.DataControl object SQL property is not available. The Recordset object Open method Source argument is used instead.

Note Specifying "...;Remote Provider=MS Remote;..." would create a four-tier scenario. Scenarios beyond three tiers have not been tested and should not be needed.

Example

This example performs a query on the Authors table of the Pubs database on a server named YourServer. The names of the remote data source and remote server are provided in the Open method of the Connection object, and the SQL query is specified in the Open method of the Recordset object. A Recordset object is returned, edited, and used to update the data source.

Dim rs as New ADODB.Recordset
Dim cn as New ADODB.Connection
cn.Open  "Provider=MS Remote;Data Source=pubs;" & _
         "Remote Server=https://YourServer"
rs.Open "SELECT * FROM authors", cn
...                'Edit the recordset
rs.UpdateBatch     'Equivalent of RDS SubmitChanges
...

See Also

Overview of the OLE DB Remoting Provider