0

I have .sql file - file is exported data from web-site. And I need to create application which can import this file to internal SQLite database. I can create simple application for working with database, but I don't know is it able to copy data from sql file in? Because .sql file is simple script in fact, therefore I'm confused. Tell me, how can I do it please, thank you.

user975290
  • 181
  • 2
  • 6
  • 15
  • Faust's answer seems reasonable, here's [another SO post](http://stackoverflow.com/questions/1953823/creating-android-app-database-with-big-amount-of-data) that's much the same. – Dave Newton Oct 30 '11 at 13:52

2 Answers2

1

You may load file as string (parse if that contain not supported commands to many blocks) and execute by one or many statements ( if you split sql command to many parts)

Sergey Gazaryan
  • 1,013
  • 1
  • 9
  • 25
0

Save that file in assets folder And then when you need to execute that .sql file, read the entire file to a string variable, and execute that string.

If you have an SQLiteDatabase object just use method execSQL and pass the sql statement

Pedro Rainho
  • 4,234
  • 1
  • 19
  • 21