SQLite database on Dropbox

I’ve seen little in other threads that apply.

Is it possible to have the SQLite database file used by a Xojo iOS app located on Dropbox so that a Desktop app can access the same file. At different times, not as a multi-user situation.

Valentina server rest with sqlite

Dropbox is not a good idea as each DropBox user has their own copy of the database. Thus each user could potentially write to the database without syncing. Thus you’ll have collisions.

If all you will ever do is read - no writes ever - then it’s probably okay.

Google “SQLite dropbox” and you’ll see all sorts of issues.

I see no problem with this, as long as you are the only user and

  1. you never ever load the app without first making sure Dropbox on that device is Up To Date

  2. you never ever leave the app running on any device and walk away from it.

  3. you never ever exit the app without then immediately waiting for Dropbox to sync your changes on that device.

  4. you never ever run the app on 2 devices simultaneously.

[quote=280821:@Ralph Alvy]I see no problem with this, as long as you are the only user and

  1. you never ever load the app without first making sure Dropbox on that device is Up To Date

  2. you never ever leave the app running on any device and walk away from it.

  3. you never ever exit the app without then immediately waiting for Dropbox to sync your changes on that device.

  4. you never ever run the app on 2 devices simultaneously.[/quote]

i have seen issues when doing the above with SQLite files on dropbox… please dont do it. it will save you a lot of heartache.

What sort of issue arises here if there’s only one user and device hitting the database at any given time? Dropbox only syncs the file after it’s saved, and at no other time. This is essentially the same as if you copied your file to the cloud after every commit.

Does the problem arise if WAL is active?

[quote=281287:@Ralph Alvy]What sort of issue arises here if there’s only one user and device hitting the database at any given time? Dropbox only syncs the file after it’s saved, and at no other time. This is essentially the same as if you copied your file to the cloud after every commit.

Does the problem arise if WAL is active?[/quote]

they got data corruption or data loss (loss of updates/records). As a storage expert (I get paid to architect, install, operations, break/fix, etc of storage devices) I strongly suggest not using storage sharing devices/services like Box, DropBox, OneDrive, GoogleDrive, etc as a place for your database file(s). DU/DL (Data Unavailability/Data Loss) events happen. It is not if, but when. There is also Data Corruption events. I get at least 3 calls a week, every week where a customer didnt listen to my advice and has put database files on a storage like DropBox, and it got “messed up”. Could be SQLite database, Access database, FoxPro database, etc.etc.etc. And 19/20 times the customer does say “you were right scott we shouldnt have done that”.

My experience with having a database file on Dropbox is with Filemaker files, and the only times I see what appears to be data loss (never data corruption) is when the Filemaker file was open on two devices simultaneously and the user got “conflicted files.” I don’t support users using Dropbox for Filemaker files, other than my wife, because of conflicted files. With SQLite files using Xojo, both of which I am relatively new to, I only have them accessed on a server, and use cubeSQL to control multi-user access to them.

I don’t doubt Scott’s warning at all. I just haven’t seen problems outside “conflicted files” and don’t understand how data corruption could arise, given how the Dropbox model works, as long as one is careful.

It does not need a Data corruption, it just needs 1 Network related delay of your sync and you loose Data.

The local copy of your database is still up to date in such a situation. What’s out of sync is the cloud copy, and your device’s Dropbox icon will tell you that. And you can force it to perform a sync before leaving leaving the device, just to make sure the sync status is correct. Then, when you go to the second device, you force a sync to make sure its sync status is correct before working on a Dropbox file.

I don’t trust clients will be that careful, though.

My experience were different. Dropbox just created a copy of my File(s) and all devices were suddenly working with their own (version of a) file. Happened multiple times.

This happened 2 or 3 years ago. Maybe this all works more reliable today, but back in those days i learned my lesson the “hard way” and never tried it again. Just not reliable enough…

:slight_smile:

After all devices are synced, the files on each device’s Dropbox folder are identical with that on the cloud, including timestamps. If that’s not what you noticed, then something went wrong.

Exactly :wink: