WWWdb gives you a way to search for text inside database tables. It provides facilities similar to those of Oracle’s interMedia product (formerly known as ConText). Klaus Reger has been working on WWWdb for about a year now, with the most recent release in April 2000. WWWdb is still in beta, but when it’s ready for prime time, it could be quite a tool.
The main web site for WWWdb is:
http://wwwdb.org |
WWWdb installation is currently a bit of a long and winding road, but we think performing this installation provides a good learning experience for those interested in Perl web technology.
Before you install WWWdb, make sure that the following are already installed on your system:
Like the Oracletool program described earlier in this chapter, WWWdb requires several non-standard Perl modules (such as LWP::UserAgent) to be in place, and you might not already have these modules on your system. You can get all of these modules from various places within CPAN.
These nonstandard modules are required only for testing purposes and
are not essential to create your new httpd
program, configured for mod_perl. The wise thing
to do, however (as with most Perl installs), is to run the
make test
step properly, as we’ll describe
in the following instructions.
You can get the first set of special Perl modules from the CPAN pages of Gisle Aas and Graham Barr at the following web sites:
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/G/GA/GAAS/ |
ftp://ftp.funet.fi/pub/languages/perl/CPAN/authors/id/G/GB/GBARR/ |
These special modules include the following:
Digest::MD5
MD5 Message Digest algorithm
Used to parse sections of an HTML document
Used to encode and decode Base64 strings
FTP Client class (contained within the libnet
library)
Uniform Resource Identifiers
You will also need to download and install LWP itself. You can get
LWP from the libwww-perl
library, which you can
also pick up from Gisle Aas’s CPAN site. LWP installs in the
usual Perl manner.
To run WWWdb, you will also need to download and install the following additional non-standard Perl modules, available from the Perl contributions to CPAN of Gerald Richter, Rich Bowen, Michael G. Schwern, Norman Walsh, Mike Shoyher, and Steffen Beyer at:
The following are the modules in this set:
You may also require the following:
Once you’ve installed all the necessary Perl modules, follow
these steps to install WWWdb (first, though, check through the
INSTALL
file in the WWWdb distribution—and
remember that this is beta, so check it well):
Download WWWdb from http://linux.twc.de/wwwdb/.
Configure your .. /conf/httpd.conf
file by
appending WWWdb’s
ApacheConfig.addon
file to it. The contents of
this file are shown here (note the
PerlTransHandler
directive we enabled when
configuring mod_perl):
# <IfDefine PERL> # For SuSE 6.2 # URI-Translation for WWWdb/<Database>/<Table>PerlTransHandler
Apache::WWWdb_TransUri
# </IfDefine> # For SuSE 6.2
Follow the instructions in the INSTALL
file for
copying the Apache::WWWdb_TransUri.pm
packaged
module, also mentioned earlier, to the correct destination. This will
be something like the following:
../perl/lib/site_perl/5.005/my_OS_architecture/Apache
Copy WWWdb.cgi
to your
/cgi-bin
directory. Make sure that the call to
Perl on the top shebang line is pointing at the right version of Perl
on your system, for example:
#!/usr/local/bin/perl
Within your http.conf
Apache configuration file,
you may want to add the following Oracle
environment variable
directives (tailored appropriately to your environment), which the
Apache server will pick up when it’s daemonized. The first of
these is based on the location of your WWWdb unpacked download
directory:
SetEnv WWWDB_BASE_PATH /home/oos/apache/cgi-bin/WWWdb SetEnv WWWDB_DATABASE Oracle SetEnv ORACLE_HOME /u01/app/oracle/product/8.1.5 SetEnv TNS_ADMIN /home/oos/ SetEnv ORACLE_SID orcl SetEnv TWO_TASK orcl
(This back-door environment variable setup via Apache is cheating a bit, so don’t tell anyone!)
Set your local host in the lib/WWWdb/Pre.rc
file, for example:
[WWWdb] Hostname = "localhost"
Go to the lib/WWWdb/Db/Oracle.rc
configuration
file and set the contained values appropriately (note that you must
always set Driver=Oracle
), as in the
following:
Driver = Oracle Username = scott Password = tiger OraSid = orcl OraHost = localhost
You may also wish to add these values:
Database = orcl DbHost = localhost
To complete your Oracle configuration setup for WWWdb, edit
lib/WWWdb/Db/Oracle.pl
to ensure that the Perl
version is set correctly on the top line, as with the
WWWdb.cgi
executable described earlier.
When setting up the required DBIx::Recordset Perl module, ignore all the databases you’re asked about except Oracle, by entering a single period or full stop character ( . ), as in the following:
ADO [dbi:ADO:test].
Multiplex [dbi:Multiplex:test].
Oracle [dbi:Oracle:test]dbi:Oracle:orcl
Username []scott
Password []tiger
Proxy [dbi:Proxy:test].
The other Perl modules needed by WWWdb have no such complications.
Just a few more steps now, and we’ll be ready, promise!
Now go to your Apache
/htdocs
directory, and symbolically link in the
WWWdb download directory, which has numerous associated files (e.g.,
images) that the main WWWdb.cgi
script will be
looking for. These are located within the download (alternatively,
copy the entire directory structure across). We did this symbolic
link within the /cgi-bin
directory too:
$ cd ../apache/htdocs $ ln -s /home/oos/WWWdb-0.0.7 WWdb $ cd ../cgi-bin $ ln -s /home/oos/WWWdb-0.0.7 WWdb
Now, we actually prepare WWWdb for action. Run the standard Perl
configuration steps to install
WWWdb’s many Perl packages (check out the
INSTALL
file for theme variations):
$ perl Makefile.PL $ make $ make test $ make install
Once you’ve got the software installed, walk through the remaining steps.
Prepare your target database for the
searchable information capabilities of
WWWdb by running the
CreateNewDb.sh
script.
This CreateNewDb.sh
script executes the
InstallDB.pl
program,
which creates the necessary WWWdb tables within your Oracle test
database and fills them with all of WWWdb’s required
information. (You may have to alter the CSV files,
which InstallDB.pl
calls, to ensure that dates
insert correctly into your Oracle database.)
Indicate that you
require all rows to be
inserted for all tables, for at least your own language requirement
(either en
for English or
de
for German).
You may also want to change any calls to IniConf in your
WWWdb.cgi
Perl CGI script to Son-of-IniConf,
Config::IniFiles. (Once WWWdb moves out of beta, this will be
covered; the
IniConf Perl package has only recently been
retired, to be replaced by Config::IniFiles.)
Finally, we’re ready to run our new application. Assuming that you have already configured and started up Apache, you can start up WWWdb by firing up your browser and pointing it to:
http://localhost:8080/cgi-bin/WWWdb.cgi |
This should flip auto-magically to something like this:
http://localhost:8080/wwwdb/0000000000000000/Oracle/WWWdb:System:Login |
Figure 6-18 shows the WWWdb main login screen you’ll see when you start up.
Once you’ve logged in, you can experiment with WWWdb by searching for various data. For example, we tried a search on the word “Database"with the original downloaded information, and you can see our result in Figure 6-19.
WWWdb is a general web-based database tool. We mention it here because it works with Oracle, but more importantly because it is tailor-made to be extended. It is almost like a library you could use to enhance other web database applications you’re already building. As such, it could very well be a good jumping-off point for someone wishing to stake out another open source database project. We feel sure that WWWdb will become a major tool once it has been developed to its full potential.
WWWdb isn’t a completely finished product; the current software is still in beta, and its author expects to add features and make further changes to the configuration files. Nevertheless, even now, WWWdb is definitely worth a good look.