0

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
  • HttpClient for the download. Commented Oct 30, 2010 at 13:37

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

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

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.