2022

Page tree
Skip to end of metadata
Go to start of metadata

This tutorial deals with implementing Database to Database integration using DBSync. The tutorial shows how data exchange can happen between 2 MYSQL databases.

Environment -
  • Source : MYSQL Database.
  • Target : MYSQL Database.
  • DBSync : DBSync Enterprise OnPremise Edition.
  1. Setup your Database for Integration. For this Tutorial I will use MySQL Database Named "salesforce".
  2. Create tables "dbAccount" and "dbAccountNew" in Database with following script.  
Database Scripts
create table `salesforce`.`dbAccount`
 ( `AccountID` varchar(100) NOT NULL ,
 `AccountName` text NOT NULL ,
 `BillingStreet` text ,
 `BillingPostalCode` numeric(20) ,
 `AnnualRevenue` decimal(30,2) ,
 `CreatedDate` date ,
 `LastModifiedDate` datetime ,
 `NumberOfOfficeLocations` int ,
 PRIMARY KEY (`AccountID`)
 );

 create table `salesforce`.`dbaccountnew`
 (`AccountID` varchar (100) NOT NULL,
 `AccountName` varchar (300) NOT NULL,
 `BillingAddress` varchar (500),
 `AnnualRevenue` Decimal (50,2),
 `CreatedDate` datetime ,
 `LastModifiedDate` datetime ,
 `NumberOfOfficeLocations` int,
 PRIMARY KEY (`AccountID`)
 );
  1. Enter some test data in "dbAccount" table. Go To www.mydbsync.com.
  2. Select Customer Login. Enter your Username and Password. Click Sign in. Then, click on Launch to access DBSync Project page.
  3. Click on Projects on the left panel. Then, click on Create New Project. Enter Project Name DatabasetoDatabase & Save.
  4. Click on the project DatabasetoDatabase. Then, click on Create New Process. Enter Process Name Database2Database & Save.
  5. Click on Connectors on the left panel. Then click on Create New Connector. Enter Connector Name Database1. Then, select Connector type* Database Connector* & Save.
  6. Click on the new Connector Database. Enter your Database details in Connector settings.
  7. Username, Password, Type, Host, Port fields should all be updated with your Database details - Note: Database URL will get updated automatically.
  8. Click Save. Then Validate Connection to confirm connection. 
  9. Click on the process Database2Database. Then, click on Create New Workflow. Enter Workflow Name Execute & Save. 
  10. Click on the workflow Execute. Here, you will see two sections: Trigger and Rules.
  11. In the Trigger section, you will see Query Builder, Advanced Query Builder and Properties. In Rules section, you will see a button to add a new rule.
  12. In this example, Advanced Query Builder is used to query. Click on Advanced Query Builder. Then, select the datasource as Database.
  13. Click on Switch to Advanced View. In Query Builder section type the following query and click on Save and Close.
  •  Select AccountID, AccountName, BillingStreet, BillingPostalCode, AnnualRevenue, CreatedDate from dbaccount
    
  1. Go to the Rules section. Click on Add New Rule. Select target Connector, Operation, Target object and map - as per the requirement.
  2. In this example, Target Connector is database, Operation is Insert, target object is dbaccountnew.
  3. Operation can be insert, update or upsert. Insert: If this option is selected then, only new records from the source table will be pushed to target data source.
  4. Update: If this option is selected, it will update the target data source records with updated values in the source.
  5. Upsert: Upsert is a combination of insert and update. If this option is selected then, new data will be inserted in target data and old data will be updated with changed data.
  6. Click on Map. You will see a list of column names of target object dbaccountnew. You can map these columns to the required columns of source object dbaccount. You just have to drag the required column name from Schema and drop it in front of the required column name of source. In Schema, you will see the list of columns of source object.
  7. Validate Row remains "true". AccountID, AccountName and AnnualRevenue from target is mapped with the value of source columns AccountID, AccountName and AnnualRevenue respectively.
  8. Click Save and close.
  9. Go to process Database2Database. Make sure that status of workflow Execute is ON. Click 'Run Now' to run the integration.
  10. You will see the logs at the bottom in console section.
  11. If you go to target object dbaccountnew, you will see a list of records inserted from the source object dbaccount.
  • No labels