MDAC 2.5 SDK - ADO


 

Microsoft OLE DB Remoting Provider

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. The resulting effect is that you will access the remote machine as if you were a local user.

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
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.

  • Gettting 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.DataControl object Server property.

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. For example, get and print the current value of the Internet Timeout dynamic property, and then set a new value, like this:

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.

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 Connection object Open method, and the SQL query is specified in the Recordset object Open method. 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=http://YourServer"
rs.Open "SELECT * FROM authors", cn
...                'Edit the recordset
rs.UpdateBatch     'Equivalent of RDS SubmitChanges
...