Is there a standard place to store databases

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Not a lot of thought
Posts: 77
Joined: Thu May 21, 2015 2:41 am

Is there a standard place to store databases

Post by Not a lot of thought » Sun Sep 27, 2015 12:26 pm

I'm creating an application that I want to deploy initially on a PC that will install/create a SQLite local database on the machine. Eventually I want to deploy all of this on different devices, MAC, and mobile devices. I was wondering where you guys typically store the database for these machines and how you test for each one in order for the application to put the DB in the correct location based on what OS it is being installed on...or is this even a problem? Are there APIs for this if so Im couldn't locate them on Google, may not be using the right terminology.

Klaus
Posts: 13868
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Is there a standard place to store databases

Post by Klaus » Sun Sep 27, 2015 1:07 pm

The best place is probably -> specialfolderpath("documents")!

It is available on Mac, Windows, *Nix, iOS and Android and, much more important,
we have WRITE permissions there on all platforms!

Not a lot of thought
Posts: 77
Joined: Thu May 21, 2015 2:41 am

Re: Is there a standard place to store databases

Post by Not a lot of thought » Sun Sep 27, 2015 1:41 pm

Ok. Cool. Thanks. Is that a safe location from inadvertent deletion or tampering? Just curious.

Klaus
Posts: 13868
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Is there a standard place to store databases

Post by Klaus » Sun Sep 27, 2015 1:46 pm

You never can prevent users from doing dumb things! :D

SparkOut
Posts: 2857
Joined: Sun Sep 23, 2007 4:58 pm

Re: Is there a standard place to store databases

Post by SparkOut » Sun Sep 27, 2015 3:06 pm

Certainly on android (possibly on iOS too?) specialFolderPath ("documents") is inaccessible to casual browsing without root. The app has its own permission to read and write this folder, so sqlite databases created or moved here by the app will work, but dumb user action is reasonably prevented. Determined interference could still cause problems, but that is always the case. On desktop computers, the documents folder is readily accessible for read/write as ever by normal, by stupid and by malicious users.

Post Reply

Return to “Databases”