Introduction
The SQL Replication environment contains an example of how to implement the replication of a Synergy applications SDMS or RMS data to a 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. The code in the generated I/O hooks class detects and records 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 cause those changes to be mirrored to corresponding tables in the relational database.
There are several advantages to taking this kind of approach, some of the major ones being:
•You don't need to re-design your Synergy applications to store the actual application data in an SQL database. To do this properly would be a very major re-write of any application.
•You don't put the overhead of writing the data to both ISAM and SQL Server into your actual user applications, the performance overhead of which would be very significant.
•You don't make your user applications directly dependent on the database being started. If the database, or replication server are not started then the transactions will simply build up in the log file until such time as they are started.
Following the code in this examples will mean that you can implement data replication with only minimal changes to the original Synergy applications. This is not a project that will happen overnight. In order to be successful with this type of project, the major requirements are:
•Each of the ISAM files that you wish to replicate to the database must have at least one unique key.
•In the extremely rare situation where a data file does not have any unique key then you will need to add a new field and unique key in order to replicate the data from that file to a relational database.
•You will need to add a couple of lines of code each time you open (for update) a data file that is being replicated. Typically this change takes place in one or more external subroutines that are already used to open channels.
License Agreement
All software included in this sample environment is distributed under the terms of the "Simplified BSD License" (also known as the "FreeBSD License").