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 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

...

  1. use MySQL Database Named "salesforce".
  2. Create tables "dbAccount" and "dbAccountNew" in Database with following script.  
Code Block
borderStylesolid
langsql
titleDatabase 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

...

  1. Username and Password

...

  1. . Click Sign in.

...

  1. Then, click on Launch to access DBSync Project page.
  2. Click on Projects

...

  1.  on the left panel. Then, click on Create New Project

...

  1. . Enter Project Name DatabasetoDatabase & Save.
  2. Click on the project DatabasetoDatabase. Then,

...

  1.  click on Create New Process

...

  1. . Enter Process Name Database2Database & Save

...

  1. .

...

  1. Click on Connectors

...

  1.  on the left panel

...

  1. . Then click on Create New Connector

...

  1. . Enter Connector Name Database1

...

  1. . Then, select Connector type*

...

  1.  Database Connector* & Save.
  2. Click on the new Connector

...

  1. Database. Enter your Database details in Connector settings.
  2. Username, Password, Type, Host, Port fields should all be updated with your

...

  1. Database details - Note: Database URL will get updated automatically.
  2. Click

...

  1. Save

...

  1. . Then Validate Connection to confirm connection. 
  2. Click on the process Database2Database. Then,

...

  1.  click on Create New Workflow

...

  1. . Enter Workflow Name Execute & Save. 
  2. Click on the workflow Execute. Here, you will see two sectionsTrigger

...

  1. and Rules.
  2. In the Trigger section, you will see Query Builder, Advanced Query Builder

...

  1. and Properties. In Rules section, you will see a button to add a new rule.
  2. In

...

  • Once Database Adapter is selected, a query builder section will appear in properties area and a lookup icon on the right side of query builder section. Click on lookup icon and you will presented with a query section will appear on the right of lookup icon. Query section will contain all the table listing from the database. Select the table and fields from the table to auto generate the query in query builder section. You can also write your own query. In this tutorial I will be selecting all the fields from "dbAccount" table. Click on save button once done. The screen shot is shown below:

...

  1. this example, Advanced Query Builder is used to query. Click on Advanced Query Builder. Then, select the datasource as Database.
  2. Click on Switch to Advanced View. In Query Builder section type the following query and click on Save and Close.
  • Code Block
     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

...

  1. of insert

...

  1.  and update.

...

  1.  If this option is selected then, new data will be inserted in target data and old data will be updated with changed data.

...

  1. Click on

...

  1. 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.
  2. Validate Row remains "true". AccountID, AccountName and AnnualRevenue from target is mapped with the value of source columns AccountID, AccountName and AnnualRevenue respectively.
  3. Click Save and close.
  4. Go to process Database2Database. Make sure that status of workflow Execute is ON. Click 'Run Now' to run the integration.
  5. You will see the logs at the bottom in console section.
  6. If you go to target object dbaccountnew, you will see a list of records inserted from the source object dbaccount.