Using SQL-DMO and the Replication Distributor Interface

The SQL-DMO and the Replication Distributor Interface sample programs demonstrate how the two services can be used to support a heterogeneous publication. These programs use transactional replication; therefore, they work only with Microsoft® SQL Server™ Standard and Enterprise editions.

The SQL-DMO program configures a heterogeneous publication and Distributor using SQL Server. The Replication Distributor Interface program can then log any transaction that it marks for replication to this Distributor. The heterogeneous Publisher distributes the transactions as if they were coming from a computer running SQL Server and using the SQL Server Distribution Agent.

The script that configures the local computer as a Distributor is located in the \Mssql7\Devtools\Samples\Sqlrepl\Samppub directory. Use this file:

The BAT script that creates a sample working data and replication data for the Replication Distributor is located in \Mssql7\Devtools\Samples\Sqlrepl\Samppub directory. Run this file before  running the VB application:

The BAT file creates a sample working directory (\Mssql7\Repldata\Unc\Samppub) and copies the following files into the working directory:

Sample Microsoft Visual Basic® code that demonstrates how to create a SQL-DMO application creating a Publisher, publication, and subscription for use in a heterogeneous publishing environment is located in the \Mssql7\Devtools\Samples\Sqlrepl\Samppub\sqldmo directory. Use these files:

Sample C++ code that demonstrates how to implement the Replication Distributor Interface is located in the \Mssql7\Devtools\Samples\Sqlrepl\Samppub\Repldist directory. Use these files:

The project on the Intel® platform includes a Microsoft Visual C++® version 4.0 workspace file (.mdp). Double-click the workspace file to load the workspace and makefile into the Microsoft Visual Studio® environment.

The project also contains cross-platform native Microsoft Visual C++® version 4.0 makefile (.mak). For each 32-bit project, the .mak file contains Intel and Alpha AXP build information. When the project is loaded into Visual Studio, pick the appropriate target (for example, Example1 - Win32 (ALPHA) Debug) and build it.

To use the sample with Visual C++ 4.0, ensure that your Library and Include directory settings point to your own directories. To do this using Visual Studio, on the Tools menu, point to Options, and then click the Directories tab. In the Show directories for box, select Include files and Library files, and then ensure that these directories are included:

File type Directory
Include files \Mssql7\Include
Library files \Mssql7\Lib

To run the sample programs

  1. Run Samppub.sql to configure the local computer as a Distributor. Samppub.sql also creates two databases, registering a Subscriber to the first.
  2. Run Iniwkdir.bat to create the working directory and the necessary files for Heterogenous Distributer.
  3. Run the Visual Basic SQL-DMO application to configure the Publisher and a subscription.
  4. Build and run the Visual C++ application to deliver transactions to the Distributor. When the program completes successfully, the SampleTable1 table is created in the SampleSubscriberDB1 database.
  5. Optionally, create a push subscription to SampleSubscriberDB2 from the publication database using SQL Server Enterprise Manager. When creating the subscription, do not create an initial snapshot, as none will be available. Running the Visual C++ program results in transactions being propagated to both subscriptions.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.