Opening a database on Android corrupts it for desktop

MMEX4Android: Manage your finances on-the-go, encrypted for security, sync via your own cloud

Moderator: Renato

Post Reply
egdd
New MMEX User
Posts: 7
Joined: Thu Oct 15, 2015 10:46 pm
Are you a spam bot?: No

Opening a database on Android corrupts it for desktop

Post by egdd »

I am new to this software but I would really like to use it. However, I need both versions (desktop version and Android version) working at the same time.
However, when copying and opening the database between platforms, at some point the desktop application cannot open the database any more.

Steps to reproduce:

1) On the desktop, create a new database and save it as a "mmb".
2) Copy the database to the mobile phone and open the Android application.
3) Open the database (that was created on the desktop) on the Android phone.
4) Strange thing: A lot of notifications of (failing) SQL-insert-statements are shown - is that an expected behaviour?
5) The file should now have been modified by the Android app.
6) Copy the database to the desktop again and open it with the desktop version.
7) Desktop application crashes.


Desktop (Windows 7): 1.2.2
Android (Android 4.4.2): 2.22.1
User avatar
MisterY
Super MMEX User
Posts: 137
Joined: Sat Jan 24, 2015 8:11 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by MisterY »

Thanks for reporting this. It would be helpful if we got to the bottom of this corruption issue.

If you get messages on Android about failure in creating various tables, it means that it can not properly read the database. SQLite on Android (not the MMEX app) is having issues reading this file.
To confirm, please try to open the database file using something like aSQLiteManager or any other tool that can read SQLite databases on Android.
I have seen only one case so far and the database was opened but showed no tables at all.

This leads the SQLite engine to report that the database is new and that it requires upgrade to the most recent version, and MMEX then issues commands for generation of the database schema. This fails for whatever reason - it would be interesting to see the actual error message.

If you can reproduce this reliably, it would be really helpful to identify the cause.

Also, if you have another mobile device available with a newer Android version, please try there, too. The newer versions of SQLite libraries, distributed with Android, might read the file correctly.
User avatar
MisterY
Super MMEX User
Posts: 137
Joined: Sat Jan 24, 2015 8:11 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by MisterY »

Also, please see https://github.com/moneymanagerex/andro ... issues/517
where I'm documenting anything related to this issue.
egdd
New MMEX User
Posts: 7
Joined: Thu Oct 15, 2015 10:46 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by egdd »

Thanks for your reply. And yes, I can reproduce this as I said.

To assist further, I am lucky to have a second device a tablet at hand with the configuration:

Android (Android 5.1.1): 2.22.1


When I follow my described steps 1 to 7 it works on this configuration! But note that the insert commands described in point 4 still occur when I open the database.

To shed light on the whole thing I attached the three databases
  • testdb.mmb (after creation of the database on the desktop)
  • testdbPhone.mmb (after creation of the database on the desktop and opening it on the phone)
  • testdbTablet.mmb (after creation of the database on the desktop and opening it on the tablet)
The "testdbPhone.mmb" is the one that cannot be opened in the desktop version anymore.
Attachments
testdbTablet.mmb
(80 KiB) Downloaded 483 times
testdbPhone.mmb
(80 KiB) Downloaded 507 times
testdb.mmb
(69 KiB) Downloaded 493 times
User avatar
MisterY
Super MMEX User
Posts: 137
Joined: Sat Jan 24, 2015 8:11 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by MisterY »

Thank you for providing the data for analysis. This allows for some detailed comparison.

I can see that Android adds a metadata table but also runs the schema all over again, as if it is creating the database from scratch. This is weird but is not the culprit in this case.
During this process, the system on the phone does not provide the currency information, resulting in the base currency being set to -1.
This causes a problem for the desktop version as it seems it is trying to find a currency with this id.

I believe this is related to the crash reports I've received from some users whose system did not provide a valid currency, so the mobile app was crashing also. This particular issue should have been mitigated in the latest version (3.0.2) so that a defined currency is always set.
Please let me know if this is still occuring with the newer app versions.

I'm attaching the SQL versions of the databases for easy comparison with appropriate tools.
Attachments
tablet.sql.txt
(24.28 KiB) Downloaded 497 times
phone.sql.txt
(24.28 KiB) Downloaded 532 times
original.sql.txt
(23.53 KiB) Downloaded 496 times
User avatar
MisterY
Super MMEX User
Posts: 137
Joined: Sat Jan 24, 2015 8:11 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by MisterY »

egdd
New MMEX User
Posts: 7
Joined: Thu Oct 15, 2015 10:46 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by egdd »

Thank you very much for your help, it works fine now!
lindseynicole010
New MMEX User
Posts: 1
Joined: Wed Feb 08, 2017 12:11 pm
Are you a spam bot?: No

Re: Opening a database on Android corrupts it for desktop

Post by lindseynicole010 »

thanks for that.
Post Reply