0

I am developing a app where i need to keep the replica of entire database from the web server to the IOS native sq-lite database, How can i keep updated version of db or import at loading of the app in one go, What should be my approach to go with this problem, Any help would be really appreciated,

Thanks Deepesh

5
  • What type of database are you referring to? Mysql? Commented Jun 24, 2012 at 9:41
  • yes its mysql on the webserver and sqlite on the ios. Commented Jun 24, 2012 at 10:11
  • 1
    i would parse the server response in json , and use core data for storage. Commented Jun 24, 2012 at 10:21
  • Generally you'd use JSON. The other option is to build the entire SQLite file on the server and sent the file in binary. Commented Jun 24, 2012 at 11:45
  • (Note that there is no single common, freely available tool for "synchronizing" phone and server database info via incremental updates -- that you must concoct yourself.) Commented Jun 24, 2012 at 11:47

1 Answer 1

0

Looks like this is a popular problem. According to this answer,

Not every DB schema can be converted. MySQL is more complex and feature-rich than SQLite. However, if your schema is simple enough, you could dump it into an SQL file and try to import it / load it into an SQLite DB.

To do this, you can either use this mysql2sqlite.sh script like so

./mysql2sqlite.sh myDbase | sqlite3 database.sqlite

or use this answer and simply do

mysqldump database > database.sql
sqlite3 database < database.sql
Sign up to request clarification or add additional context in comments.

2 Comments

Can i run this script in objective C, in the app (for example in view did load ) becuase i want an update from the ios native app.
It is possible to run similar things in Objective-C. Look in this thread for more info on importing/exporting DB using FMDB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.