0

I am trying to install a pre-built SQLite database as per the following suggestions:

http://blog.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/

I am getting errors when I try to open the database. More specifically, I am having to split the file and cat the fragments together on the android device and use them. This seems to succeed but then one sees errors when the Android app tries to use the database.

On first launch, it gives an error

See https://github.com/rkiddy/android-database-first-loading

The error is:

 09-10 16:54:35.876    1300-1300/org.ganymede.databaseloadingapp E/SQLiteLog﹕ (5) database is locked
 09-10 16:54:35.877    1300-1300/org.ganymede.databaseloadingapp E/SQLiteDatabase﹕ Failed to open database '/data/data/org.ganymede.databaseloadingapp/databases/MyDB.db'.
      android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5): , while compiling: PRAGMA journal_mode
Ray Kiddy
  • 3,521
  • 3
  • 25
  • 32
  • "I am trying to install a pre-built SQLite database as per the following suggestions" -- that blog post is old and dreadful. [Use `SQLiteAssetHelper`](https://github.com/jgilfelt/android-sqlite-asset-helper). "I am having to split the file and cat the fragments together on the android device and use them" -- why? I package a multi-MB database in the APK editions of [my book](https://commonsware.com/Android) without issue, using `SQLiteAssetHelper`. I develop on Ubuntu (15.04 at the moment). – CommonsWare Sep 03 '15 at 20:53
  • The fileformat used by [SQlite3](https://www.sqlite.org/fileformat2.html) is very well defined, stable, and platform-agnostic. The problem is therefor likely in the 'split and recombine' or one of the transfers. – user2864740 Sep 03 '15 at 21:01

0 Answers0