0

I'am developing an application which uses sqlite for autocomplete textview. The database has more than 8000 records. Creating a database can be done with a query in onCreate(). But how do i create a database with 8000+ records in it. writing insert query for 8000 records sounds worst to me.

What's the best way to create a database with 8000+ records in it. Is there any way like dumping sql file like how we do in mysql.

Jeyanth Kumar
  • 1,589
  • 3
  • 23
  • 48

3 Answers3

1

Instead, you should put your database with a table (having 8000 records) inside the Assets folder and write a logic to Copy existing database inside your android app.

Check links:

  1. https://stackoverflow.com/a/6541043/379693
  2. Ship an application with a database
Community
  • 1
  • 1
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
  • The same logic is followed here: http://stackoverflow.com/questions/9109438/using-already-created-database-with-android/9109728#9109728 – Yaqub Ahmad Apr 23 '12 at 11:51
1

What ever approach you conduct but do it in an SQLite Transaction because it will maintain a single Journal (db cache) file for inserting all the records in one go. It will really speed up things a lot.

waqaslam
  • 67,549
  • 16
  • 165
  • 178
0

If you have the .sql file you may import it in phpMyadmin.... Just go to PHPMyadmin URL... create an empty database.... click on import... Browse the sql file click on Go...

That's it

Anwar
  • 672
  • 4
  • 16