Databases
CS 321 Lecture,
Dr. Lawlor, 2006/04/12
Databases are a really cool way to store data that:
- Is more structured than files (a database is not just bytes!)
- Allows much faster querying than files (databases build trees of searchable info called "keys")
- Can survive crashes better than files (some databases have been continuously added to since 1970's)
The down sides to databases are all preventable:
- Databases are managed by a separate "database server" program, and almost never by the OS itself like with files.
- Databases are usually accessed via a 1970's ASCII abomination called SQL. People seem fine with this.
- Databases are seen as a "business problem" of no interest to games, scientific computing, or other code.
MySQL is a popular free database implementation. It's got a decent tutorial, but it's really long.
I've got a super-condensed tutorial ("type this now") in the README of the sample code below. Here's some of my sample MySQL code in C and Perl (Directory, Zip, Tar-gzip).
You can install MySQL on your Linux or Windows machine. But I've also posted a small pre-built QEMU Linux virtual machine with MySQL already installed
(32MB .zip QEMU x86 virtual machine). This should let you try out
MySQL without having to go through the fairly painful setup process.