in reply to Where to put an application database?

boftx:

To me, it depends on the "kind" of application. If the database would best used by everyone, I'd prefer a common data area (such as /var or C:/Program Data/ or equivalent. If it's an application where every user would want their own copy, I'd probably prompt the user for their preferred location (I have the same aversion to applications cluttering up my personal work area with directories and files of their own). Leaving the default as the personal work area could be fine, so long as it's easy to override and/or change, so I'm not stuck with it.

I'd avoid putting the database in the same directory with the module, though. There may be some good arguments for it, but I've not seen a case where I'd consider it. Generally, I don't back up my OS and App directories, but I *do* back up my user and data directories. I don't back up the OS and App stuff since I can simply reinstall it. But it would suck if I couldn't retain my data without specifically choosing to back up a particular App directory.

That's my $0.02, take it for what it's worth...

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Where to put an application database?

Replies are listed 'Best First'.
Re^2: Where to put an application database?
by boftx (Deacon) on Oct 17, 2014 at 17:25 UTC

    I agree with it depending upon the "kind of app" as you put it. Since this could be used by a number of different users I m leaning towards using /var as the data dir.

    The bigger issue, in my mind, is having the database files be mode 666 maybe. I know that Oracle, MySQL and others are setuid to get around that, but I need to check the docs for SQLite to see if it does that, too.

    You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

      boftx:

      A lot of databases handle the permissions issue by having a separate server process that actually does the database work, and all clients just submit requests to that process to get the work done.

      SQLite, though, doesn't use a server process. Instead every client has a copy of the code to perform database updates. In that case, the file will need to be modifiable by everyone if you want them to be able to make any changes.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

        OUCH!

        You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.