Introducing Replication Programming
As an alternative to using SQL Server Enterprise Manager, you can use the following programming interfaces to implement, administer, and monitor replication:
- Microsoft® ActiveX® controls, when used within custom applications that employ Microsoft Visual Basic® or Microsoft Visual C++®, provide programmable controls for administering and controlling the Snapshot Agent, the Distribution Agent, and the Merge Agent. These controls can be used to program activities needed to operate replication. Using ActiveX replication controls, you can build custom applications to configure and administer replication. Benefits include:
- Installing a smaller portion of Microsoft SQL Server™ 2000. Because the client has no dependency on the full SQL Server 2000 installation, the user only needs to install Microsoft SQL Server 2000 Desktop Engine.
- Controlling when replication activity occurs. For example, for an application that provides online and offline capabilities, you may want to expose a Synchronize button. That button can be associated with the merge ActiveX control so that whenever users click the button, the merge ActiveX control connects to the Publisher and activates the Merge Agent for the specified publication, which then merges and synchronizes the data. For more information, see Programming Replication with ActiveX Controls.
- Installing a smaller portion of Microsoft SQL Server™ 2000. Because the client has no dependency on the full SQL Server 2000 installation, the user only needs to install Microsoft SQL Server 2000 Desktop Engine.
- SQL Distributed Management Objects (SQL-DMO) allow you to create custom applications using Visual Basic or C++, which allows you to configure, implement, or maintain your replication topology. SQL-DMO can be used to program replication administration such as configuring distribution and creating subscriptions. The SQL-DMO objects can be used in programming languages such as Visual C++ or Visual Basic.
- The Replication Distributor Interface allows you to replicate data from heterogeneous data sources such as Microsoft Access or Oracle. The Replication Distributor Interface is an OLE DB service provider that allows heterogeneous data sources to publish data to SQL Server Subscribers using snapshot replication or read-only transactional replication. It can be used to develop a custom replication application based on proprietary data sources. For more information, see Programming Replication from Heterogeneous Data Sources.
- Transact-SQL system stored procedures allow you automate some replication tasks, configure replication, and implement subscriptions on multiple servers. Stored procedures are frequently used in scripts that can be run when configuring replication on multiple servers (for example, creating subscriptions to a publication on multiple Subscribers). In most cases, you are better served by using the programming interfaces SQL-DMO and ActiveX replication controls for programming replication rather than writing direct calls to the system stored procedures.