JDBC Connector Guide > Data Synchronization Tasks with JDBC > Data Synchronization Example
  

Data Synchronization Example

You need to synchronize event data and venue data between a MySQL database and Microsoft SQL Server to create an event catalog. In MySQL, you have an event object and a venue object. You need to read from these related MySQL objects before writing to Microsoft SQL Server. For the initial data load, configure a Data Synchronization task to insert data to Microsoft SQL Server. For incremental updates, schedule a Data Synchronization task to upsert data to Microsoft SQL Server.
Create JDBC_IC connections to connect to the MySQL database and Microsoft SQL Server database. Configure a Data Synchronization task to use the insert operation.
Select the MySQL objects you want to use, and the predefined relationship displays.
The following image shows the event object and the venue object added as source objects: The step of the Data Synchronization task wizard shows that for the JDBC MySQL connection, two source objects, event and venue, have been added. The wizard displays the relationship path that has been defined in MySQL between the event and venue objects.Source
Select the Microsoft SQL Server target object in which you need to load the data.
Select the Microsoft Server target object in which you need to load the data.
Use a filter if you want to filter the incoming source records.
Use a filter if you want to filter the incoming source records.
Map the fields that you want to insert.
Map the fields that you want to insert.
Save and run the task for the initial data load.
You can synchronize the data incrementally after the initial data migration. Create a Data Synchronization task that uses the upsert operation with the same MySQL source and the same Microsoft SQL Server target. To upsert data that has changed since the last Data Synchronization, configure a simple data filter that uses the $LastRunTime or $LastRunDate variable.
The following image shows a data filter that loads records when the last modified date is greater than the $LastRunTime system variable:
The Data Filter window in the Data Synchronization task wizard shows that for the MySQL object selected, the data is filtered when the LastModifiedDate field is greater than the $LastRunTime.
Save the task and configure it to run on a schedule so the data remains synchronized.