tags:

views:

39

answers:

1

What's the easiest way to populate a SQLLite table with data off a URL?

I'm writing a Delphi web app that will generate a file on a server for my Android app to download.

In Delphi, I'll probably save it as a .csv file and use bulk import to import into MS SQL Server.

What's the easiest / best practice way to do this in Android? How would I download the file from the URL and then load it into SQLLite?

Many thanks for any pointers.

+1  A: 

How would I download the file from the URL

Use HttpClient, as Frayser indicates.

and then load it into SQLLite?

You neglected to tell us what format you will use for the download.

If the format is the CSV you mentioned for other uses, parse it and use SQL INSERT statements (execSQL() or insert() with your SQLiteDatabase object). Wrap the INSERT statements in a transaction to improve performance, since each transaction requires a flash write, and flash writes are slow.

If you are downloading a complete SQLite database, just put it in getDatabasePath(), and open it when needed.

CommonsWare
Thanks, I tried to explain, whatever format is easiest / best. CSV it is!Many thanks
Hein du Plessis