How would I sync a SQL database using a Smart Phone to store and forward changes? (No direct connection between source and target) RRS feed

  • Question

  • I have a scenario where my occasionally connected clients (WPF app, SQL Express DB) need to sync with a central SQL Server. The client machines are used in the field, and often times do not have any sort of connectivity. The plan is to use a smart-phone as an intermediary store and forward device. The client would push local changes to the phone. Then disconnect the phone, power down the laptop, and drive down the road. While driving, the phone will come into connectivity and upload the changes to the central office.

    I need to know if I can do this with Sync Framework.

    The documentation seems to indicate that the sync orchestration wants access to both the source and the destination. In this case, I don't have connectivity to the destination (central server). I suspect that I need to find a way to cache the destination's knowledge locally, but I'm not sure if that's appropriate.

    It's may be worth noting that the client machines will have direct connections on a periodic basis, but not a daily basis.

    So the scenario is:

    1. Client machine is directly connected on Monday and does a full sync.
    2. On Tuesday, user goes out in the field and uses app, generating updates / inserts / deletes to the SQL Express database.
    3. User "syncs" client machine to their smartphone. (Save file(s) to the SD card)
    4. User turns off client and drives down the road.
    5. Smart phone comes into connectivity and uploads files to central office.
    6. Central office "syncs" data from uploaded file(s) to the central SQL Server database.
    7. Repeat 2-6 for Wednesday, Thursday, Friday.
    8. On the following Monday, user is again directly connected for a full sync.

    How do I do this with Sync Framework?

    Does it help if I can have the smartphone downloading something daily from the central office (like central office's knowledge)? Is there harm done if the client is orchestrating a sync session against stale cached knowledge from the central office?

    There is no DB on the phone. The phone is just a store and forward device. The phone almost functions like a USB stick to transfer the changes from the source DB to the destination DB. The key point here is that there is no direct / live / active connection between source and destination. How do I accomplish this with Sync Framework?

    Thanks in advance!

    • Edited by NathanAW Wednesday, May 16, 2012 12:51 PM Clarification
    Tuesday, May 15, 2012 8:13 PM

All replies

  • have you looked the Sync Framework Toolkit?

    what's the database for your smart phone?

    Wednesday, May 16, 2012 11:26 AM
  • Hi @JuneT,

    In this case, the source database isn't actually on the phone itself. Rather it's on a laptop. I just need to use the phone as a store and forward device between the laptop and the central server. Almost like a smart USB stick.

    I want to push a file to the device, which will be uploaded to the central office when the phone comes into connectivity. Then the central office can complete the "sync" by processing that file and merging its contents in the central database.

    - Nathan

    Wednesday, May 16, 2012 11:57 AM
  • the framework works with database providers to connect to specific databases. file sync is different than database sync provider as well.

    if by file you mean copying the actual SDF to your smartphone, then it might work uploading the SDF itself, if you're smart phone supports updating the SDF. or even synching the SDF directly from the smartphone without uploading the sdf itself.

    if by file, you mean other format than SDF, then you will have to write  a custom provider to sync it to a database.

    • Edited by JuneT Wednesday, May 16, 2012 12:16 PM
    Wednesday, May 16, 2012 12:15 PM
  • Thanks @JuneT,

    I'm thinking about the option of writing a custom provider. My issue boils down to the question:

    "Can I write a provider that can sync without having a live connection to the destination."

    Most of the examples show a scenario where the source can open a session and "chat" with the destination to get knowledge and enumerate changes. In my case, I have no connection to the destination.

    I suspect that I might be able to make this work if I were to somehow keep some cached knowledge on the smart-phone or something. Then I'd use a custom provider to package up the changes and source knowledge into a custom "file". Then I'd copy that to the phone so that it could be uploaded to the central office at some later point in time.


    Wednesday, May 16, 2012 12:23 PM
  • i suggest you have a look at Sync Framework toolkit.
    Wednesday, May 16, 2012 1:03 PM