| Using Oracle DBXML From Perl and PHP |
|
|
|
| Written by Josh B |
| Friday, 23 October 2009 18:17 |
|
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 ModulesInstalling PHP ModulesFirst, install the db4 extensions. Need to go this directory :
cd db-4.6.21/php_db4
cd dbxml/src/php/ and then phpize 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 Restart Apache: /etc/init.d/apache2 restart Installing Perl ModulesFirst 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. perl Makefile.PL
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 |




