Skip to content
Steve Ives edited this page Dec 4, 2020 · 13 revisions

SQL Replication via Synergy DBL I/O Hooks

This environment contains an example of how to implement the replication of a Synergy applications SDMS or RMS data to a Microsoft SQL Server relational database, in near-to-real-time.

The techniques demonstrated in this example are based in large part on code that is automatically generated using CodeGen. It is therefore a requirement that the data structures and files that are to be replicated, including key definitions, are accurately described in a Synergy repository.

Once the bulk of the code that is required to achieve the replication of data has been generated, the underlying application is modified by the addition of an I/O hooks object to any channels that are opened for update to files that are to be replicated. If your application already uses one or more subroutines to open its data files then those subroutines will be the only places that you need to alter, and the required change will typically be the addition of just a few lines of code to those routines. Code in one of the I/O hooks classes will detect and record changes to the ISAM and relative files that are being replicated.

Once this change information is being recorded, a single process called the "replicator" is used to replicate those changes to corresponding tables in the relational database.

There are several advantages to taking this approach, including:

  • It is not necessary to re-design your Synergy application to store the actual application data in a relational database; doing so properly would be a very major re-write of any application.

  • Your user processes won't suffer from the significant overhead of writing data to both the ISAM and relational databases.

  • You don't introduce a direct dependency on the database in your core Synergy application. If for any reason the database or replication server are unavailable then transactions will simply queue up for processing later.

Following the code in this example will result in you implementing data replication with very minimal change to your original Synergy application. In order to be successful with this type of project the major requirements are:

  • Each of the ISAM files that you wish to replicate must have at least one unique key.

  • In the rare situation where an ISAM file does not have a unique key, you will need to add one in order to replicate the data from that file.

  • You will need to add a single line of code each time you open for update any data file that is being replicated. Typically this change takes place in one or more external subroutines that are used to open channels.

Clone this wiki locally