0

The main scope of the question is to identify what/how non-web based applications aka an executable stores information.

Surely, web-based applications use databases. Does a non-web based app store information in a compiled of a database module? For example, if we have postgres, would we compile the postgres source and use it in someway with a driver to store info locally?

If not how is information stored? Are databases only for web-based apps? Why would someone compile/build/make the source of a DB?

TLDR: An example situation;

We have a non-web based game, where exactly do you store character stats, progress, encounters etc. do you use a database for this? If not how?

1 Answers1

1

There are lots of options:

  • Static files (json, yaml, xml, .ini, custom text formats, ...) read into memory, modified, and written out periodically and/or on exit. Care is taken to write the new file, then rename it to overwrite the old one.

  • Embedded SQL databases like SQLite, Firebird, Microsoft JET, HSQLDB, Derby, etc

  • Embedded key/value stores like Berkely DB

  • Standlone SQL databases, bundled with the app installer, like PostgreSQL, MySQL, MS-SQL, etc. Or the same DBs installed separately by the user, where the app is then configured to use an existing DB.

  • System configuration databases like the Windows Registry. Not suitable for storing data that changes a lot, is updated frequently, or for storing a lot of data. Don't do this please.

  • Platform and language specific facilities like Java or Swift object serialization. Best avoided, but they have their place.

  • Various wacky custom formats and schemes

It's completely unrelated to whether you compile sources, etc. Most embedded databases are available as a shared library (DLL, dylib, etc) with headers. You might link them to your program at compile time, but only in the same way you link the database drivers of some other DBs (or driver frameworks like ODBC) into your app.

No matter what you actually use, in most cases data gets stored in the desktop user's profile, or in a mobile app data store sandbox. The main exception is DB servers

Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
  • can I know why someone would compile a source of a database? When you say that standalone databases use an existing database, does that mean that there will be for example a postgres server hosted while the app is running in order to have the interactions take place? – Nothingness Oct 19 '17 at 13:54
  • You'd compile it if you wanted non-standard settings/options not available without recompiling. Or if you're using a niche platform where binary packages are not readily available or not used at all. Or you're a control-freak. Or you're testing development versions. – Craig Ringer Oct 19 '17 at 15:47
  • Correct re standalone. It might run as a service that stays active whether or not the app is running. Or it might be managed by the app and started and stopped on demand. See e.g. https://stackoverflow.com/q/24625490/398670,https://stackoverflow.com/q/25269274/398670 – Craig Ringer Oct 19 '17 at 15:49
  • Thank you very much, all of this has completely cleared my doubts! – Nothingness Oct 19 '17 at 15:54