2022

Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This tutorial deals with implementing Database to Database integration using DBSync. The below tutorial illustrates 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 be using use MySQL Database Named "salesforce".
  2. Create tables "dbAccount" and "dbAccountNew" in Database with following script.  
Code Block
borderStylesolid
langsql
titleDatabase Scripts
borderStylesolid
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 User Name Username and Password and click . Click Sign in. Click Then, click on Launch to access DBSync Project page.
  3. Click on Projects in  on the left panel. Then, click on Create New Project, enter . Enter Project Name DatabasetoDatabase & Save.
  4. Click on the project DatabasetoDatabase. Then, click  click on Create New Process, enter . Enter Process Name Database2Database & Save.
  5. Click on Connectors in  on the left panel, . Then click on Create New Connector, enter . Enter Connector Name Database1. Then, select connector  select Connector type* Database Connector* & Save.
  6. Click on the new Connector Database, enter . Enter your database Database details in Connector settings.
  7. Username, Password, Type, Host, Port fields should all be updated with your database details, Database details - Note: Database URL will get updated automatically.
  8. Click on Save and then . Then Validate Connection to confirm connection. 
  9. Click on the process Database2Database. Then, click  click on Create New Workflow, enter . Enter Workflow Name Execute & Save. 
  10. Click on the workflow Execute. Here, you will see two sectionsTrigger & 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 Avanced Advanced Query Builder. Then, select the datasource as Database.
  13. Click on Switch to Advanced View, in . In Query Builder section type the below following query & and click on Save and Close.
  • Code Block
     Select select AccountID, AccountName, BillingStreet, BillingPostalCode, AnnualRevenue, CreatedDate from dbaccount
    
  1. Now go Go to the Rules section, click . Click on Add New Rule, select . Select target connectorConnector, operationOperation, target 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 . 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 infront 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 on Save and close.
  9. Now, go Go to process Database2Database, ensure . Make sure that status of workflow Execute is on, click on ON. Click 'Run Now' to run the integration.
  10. You will see the logs in 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.