+ Reply to Thread
Results 1 to 2 of 2
This is a discussion on Data Sync within the Salesforce Coding Discussions forums, part of the Salesforce category; Hi, I'm a beginner in terms of Salesforce and I would like
  1. #1
    dallasclark is offline Junior Member
    Join Date
    May 2008
    Posts
    1

    Data Sync

    Hi, I'm a beginner in terms of Salesforce and I would like to know what would be the best way to sync data between Salesforce and a remote MySQL database. I would like to be able to edit data on both Salesforce and MySQL. I am aware of sync issues ie: entry edited on Salesforce and MySQL at the same time.

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    DC,

    First off thanks for joining the site. I noticed that you also added me as a contact on your IM, please contact me any time!

    Your question is one that I get asked a lot and will try and answer to the best of my ability.

    Syncing between a local database, whether it be Oracle, MySQL, or some other DB is something that you have to really put into a think tank. You have to visualize what you want to accomplish. What I will try and do is explain how I do it and see if it maybe a way for you to accomplish your task at hand.

    When you say sync, and I think I read a post of yours on the Salesforce Developers forum - do you want to sync both ways?

    If you need to build a Schema for your MySQL Database, try my MySQL tool:

    Here's what I have in place:

    Script 1:

    In this example I will use the Account object, a script that runs twice a day on CRON that connects to Salesforce via the API. Then it runs a SOQL query and performs extractions. I download all fields from a given object. I query 1000 records, insert those records in the DB, get the next set of 1000 records and insert those into the DB, and so on, and so on.

    Script 2:

    This is the script that performs the sync between Salesforce and my local DB. You can run this via CRON. You write whatever query you want too to gather the data needed to either update, insert or upsert (a Salesforce built in tool that allows you to updated/insert based on a "external field" that you set on a custom field in an object. We use it on a text field that I created which is an Id that is assigned to accounts, an example: 4321 is the account_id of Cheveron. The upsert function in the API checks to see if this account_id is already in Salesforce and if it is not, it creates it. If it is already in Salesforce, it updates it; hence the word upsert.

    I am not sure if this gives you a start, but I would be glad to talk to you more about what it is you are trying to accomplish. If you are trying to do a live sync between Salesforce and MySQL, well there are some options there, but it would be a whole lot more difficult to accomplish > http://www.mikesimonds.com/using-sal...s-php-t95.html

    Let me know if that helps and I will try and help you out as much as I can


    ~Mike

    If you are wanting to accomplish a live MySQL database update on a record when something is updated in Salesforce, you would be wanting to look at the outbound messaging. I added a schema that I created from a developers account using my MySQL tool to build a schema!
    Attached Files Attached Files
    Last edited by mike; 05-20-2008 at 08:21 AM. Reason: Added MySQL schema

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2