Saturday, July 12, 2008

Transfer data between online/offline database

I have some suggestion to u to do that.I describe the procedure and steps below.If u caught the logic then u can implement it as ur own way..
Step1: The ofline database and Online database table structure should same. It is better to avoid auto increment field in the tables.If you have auto increment field in offline database you should drop the auto increment field from online database.

Step2: First read the last inserted ID and total data for each table and each database(offline and online) and u may write the information in 2 seperate CSV file like offline.csv and online.csv.

Step3: Read and Compare both CSV file.
Step4: If found one table data are not equal in both database then update that online table with new/rest of the row.
Step4.1: To update online database first read the specific table data from offiline database then store them in array then connect to online database and upadate online table with the stored array data.