0

I have a user who reports that he has a HTC Desire running Android v 2.2.2 and a HTC Flyer tablet running Android v 2.3.4.

Any databases (Sqlite) that are created by my app on his tablet cannot be read on his phone. Any databases created on his phone can be read on either device. (Hope I got that the right way round but hopefully you get the idea)

I guess this is because of different versions of the database engine. Is there a way to handle this and to convert one database to the same format as the other allowing both devices to open the database regardless of which device created it?

I did find this link which suggest using the command line to do the conversion. Not very helpful on a device though. http://www.sqlite.org/formatchng.html

Kuffs
  • 35,581
  • 10
  • 79
  • 92
  • Any specific error messages reported? – Kumar Bibek Jan 28 '13 at 17:25
  • No errors. just unable to open database. SQLite database browser cannot open it either. – Kuffs Jan 28 '13 at 17:26
  • Sounds like the database may be encrypted. – Hot Licks Jan 28 '13 at 17:27
  • Why 2 devices are sharing the same database in first place? Is it just a test or the final behavior? – Alex Oliveira Jan 28 '13 at 17:29
  • Check this. May be this could help. http://stackoverflow.com/questions/4718934/sqlite-issues-with-htc-desire-hd – Kumar Bibek Jan 28 '13 at 17:30
  • How about creating the database using that version which is ok for both of them and then using this `already created database` as: http://stackoverflow.com/questions/9109438/how-to-use-an-existing-database-with-an-android-application/9109728#9109728 – Yaqub Ahmad Jan 28 '13 at 17:31
  • The app has been available for over 2 years and I have never run into this before. There are simply too many databases out there now to consider starting to package a database as an asset at this late stage. – Kuffs Jan 28 '13 at 17:37
  • I've never run into incompatible SQLite DBs. I don't think this is a version problem. – Hot Licks Jan 28 '13 at 18:54
  • See [this list](http://www.sqlite.org/formatchng.html) for version compatibility. – Hot Licks Jan 28 '13 at 20:11
  • I already gave that link in my original question but thanks. – Kuffs Jan 29 '13 at 06:35

1 Answers1

0

It seems the problem is that WAL mode was turned on. http://www.sqlite.org/wal.html

WAL is supposed to default to Off (and on all my Nexus devices it does).

I can only assume some manufacturers thought it would be fun to default the setting to On and therefore make the databases incompatible with earlier versions.

Wal mode is not supported in any version of SQLite earlier than 3.7.0 and if attempted, databases cannot be opened if this flag is set on them.

Kuffs
  • 35,581
  • 10
  • 79
  • 92