Main Menu



You are here: Home
Using Oracle DBXML From Perl and PHP PDF Print E-mail
Written by Josh B   
Friday, 23 October 2009 18:17

Tags: dbxml | oracle | perl | php | xml

This is a quick guide to installing and using Oracle Berkelely XML Database from Perl or PHP. XML Databases have become more common over the years, but they're not really mainstream yet. As their name implies, they are very useful for storing XML in an ordered manner. And their key advantage is they are very efficient at searching that XML using languages such as XQuery.

While it's useful to use either the command-line tools, or the interactive interface to add Containers and XML documents, it is much more useful to do this programatically...

Why am I posting this...? Mostly because I had to do this at work for a Project that would benefit from such a thing. And yes, the jury is still out on whether its going to be useful. I'm also posting this to share since I found this a bit tricky. But (as mostly usual —- I hope...!) I prevailed in the end.


NB : This guide will assume you have already install Oracle Berkelely XML. (AKA, DBXML...). I installed the software into ~/dbxml-2.4.16, and then sym-linked ~/dbxml to ~/dbxml to avoid much typing. In practice, on a production machine, I would install this to /usr/local/dbxml.

Now that it is installed make sure you remember to add /path/to/dbxml/install/lib to $LD_LIBRARY_PATH. We'll explicitly by setting the path for PHP, but its good practice to add it after installation.

Installing The Language Modules

Installing PHP Modules

First, install the db4 extensions. Need to go this directory :

 

cd db-4.6.21/php_db4
phpize
./configure --with-db4=/path/to/dbxml/install
make
make install


Note down the install directory just in case you need to find them again. Next is the dbxml extension:

cd dbxml/src/php/

and then

phpize
./configure --with-dbxml=/path/to/dbxml/install/
make
sudo make install

Add the following to the end of php.ini. (This may live in etc/php5/apache2/ or etc/php5/cli/ depending on how you will call the modules)

 

; dbxml extension
extension=db4.so
extension=dbxml.so

Restart Apache:

/etc/init.d/apache2 restart

Installing Perl Modules

First of all, you don't want the modules in db-4.6.21/perl/ . These are for Berkeley DB only...! Instead look in  ./dbxml/src/perl/ and this is where the Sleepycat::Db module source files are kept. There's a requirement for "BDB XML C++ library version 2.4 or greater" but I'm guessing that's included with the database you install earlier.

Do :

perl Makefile.PL
make
make test
sudo make install


I got lots of "deprecated conversion" warnings, but I decided to ignore these. The tests ran ok and so far there have been no problems while running Perl scripts with them.

At some point I will be investigating the Java packages that are included.

Next Time...! Code samples for PHP / Perl

 

 

 

Last Updated on Friday, 23 October 2009 13:42
 

Add comment


Security code
Refresh

Joomla! Template by Red Evolution - Joomla Web Design