I have to use remote MySQL database information in my Android application.
Is there a way that I can Translate MySQL data to SQLite format and store them in the SQLite DB to access by the mobi开发者_开发百科le application. Also I need to update the SQLite DB content when a modification happen to MySql data. That I have decided to do when application loads, to check any modification happened and to change the SQLite DB Accordingly. Is this possible.
Any sample coding/ Idea/Link is highly appreciated.
Thanks in advance
Can you use mysqldump
to export the information, for later import into SQLite? mysqldump
will export data you specify, and save it into a file containing a bunch of SQL statements to rebuild the data.
So for example, if you run the dump on a schema with 3 tables and a bunch of rows in each, you end up with a .sql file with commands to build those 3 tables and then enter all the rows. The SQL can be used to import into another MySQL database or most other SQL databases.
mysqldump
I would think you could create a batch script of some sort to run the dump command, then use SQLite to pick up and run the .sql file.
精彩评论