Hi,
I am creating an AIR (Andriod) which is basically one of CRM (customer relationship management) application. Application maintains a local databse for user operations which includes CURD operations on databse. If application gets the connectivity to internet then the records will get stored in local db as well as on server db at the same time.
But when application is in offline mode (i.e no internet connectivity) then CURD operations will performed on local databse...
My Problem is when application comes again online mode (gets internet access) then the local DB latest changes needs to be sync to server db.
Please provide me a sample code, some ideas for coding, some links for any opensource library etc which points me for local db sync to server db
thanks in advance.
There are several AIR/SQLite frameworks around, but I don't recall seeing anything that would automagically sync a server database to a local database.
I've had good luck with Paul Robertson's framework:
https://github.com/probertson/air-sqlite/network
It has a bunch of nice features which take care of the grunt work -- transactions (they're really important for optimizing performance), pooling -- and leave you with mostly just having to write your SQL queries and callback functions. I used Nate Ross's fork of this project and made a few very small tweaks. Paul was recently re-hired by Adobe, so he might be around somewhere to answer questions. I found his blog (http://probertson.com/) to be the best source for SQLite and AIR info.
You'll need a way to administer your local db, preferably one that knows about the proprietary features Adobe added to the AIR version of SQLite. The pickings are slim in this area. I've been mainly using Lita (https://github.com/davidderaedt/Lita). Lita's biggest drawback is its lack of error reporting when executing a SQL command, so I've also been using SQLite Run! (http://probertson.com/projects/run-air-sqlite-query-testing-tool/) because it does throw an error when you try to execute a problematic SQL statement.
SQLite Expert Personal (http://www.sqliteexpert.com/) is a much better admin tool (and it's free), but it doesn't know about Adobe's proprietary features. But if you're syncing to a server database, this probably won't matter much, if at all.
Btw, it's actually CRUD, not CURD: create, retrieve, update, delete.
Hey,
Thanks for explaination and some of URL.
Actually what i need to is atleast a methodology, how the sync happens back and forth. In my case local as well server DB both are changable at any time. for example say that client is in offline and has created some new records which are stored on local DB, at the same time admin may also created new records on server db. when client comes into online mode, the data sysc should happen from local to server db as well as server db to local db.
I want to know how to implement this, any methodology, some pattern, some ideas etc.
I get the feeling you're looking for a "SyncLocalAndRemoteDatabases( )" function. Someone may have created something like that as part of a framework, but if not then you will have to roll up your sleeves and write some ActionScript to do this.
To start, the web server programmer creates a way for the app to send and receive updates. One way would be for this programmer to create a web service with methods (functions) for the app to call. Another would be for this programmer to create methods that use Flash Remoting.
So you have to talk to the person who is programming the web site and find out how this person plans to handle requests from the app. AFAIK Flash Remoting is the fastest and most efficient way to transfer data between a server and a Flash/AIR app -- take a look at http://www.jamesward.com/census2/. Flash Remoting transfers data using the AMF3 format, which is also an option in Flash CS. If the server programmer doesn't know Flash Remoting -- a likely scenario -- then you might have to send and receive data as XML or JSON or name/value pairs.
HI,
I have got a link on the topic. i googled lot then i got the link, which explain how to pereform the sync fro local DB to server DB.
Here you go:
http://blog.ankitverma.com/2010/03/onlineoffline-database-synchronizat ion/
North America
Europe, Middle East and Africa
Asia Pacific