Tag: Database

Storing Hierarchical Data in a Database

Storing Hierarchical Data in a Database

Whether you want to build your own forum, publish the messages from a mailing list on your Website, or write your own cms: there will be a moment that you'll want to store hierarchical data in a database. And, unless you're using a XML-like database, tables aren't hierarchical; they're just a flat list. You'll have to find a way to translate the hierarchy in a flat file.

Storing trees is a common problem, with multiple solutions. There are two major approaches: the adjacency list model, and the modified preorder tree traversal algorithm.

In this article, we'll explore these two methods of saving hierarchical data.


Debian, Oracle XE and PHP(5)

Oracle can be a real pain to get installed on your server, however, since they’ve created a Debian (Sarge and later) repository it is a lot easier. Getting it to work with PHP (in this case version 5) will be another story which this small how-to will describe.

First, add the Debian repository to your /etc/apt/sources.list by adding the following two lines at the bottom of the file;

# Oracle XE
deb http://oss.oracle.com/debian unstable main non-free

Afterwards run the following chain of commands as root;

wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add -
apt-get update
apt-get install oracle-xe

Now Oracle is installed on your system and it will ask you to run /etc/init.d/oracle configure first.
Since this was the easy part let’s continue to the hard part; enabling Oracle in PHP. (continue reading…)


Copyright © 1996-2010 Re:morse.nl. All rights reserved.
iDream theme by Templates Next | Powered by WordPress