5.2 Apache::OWAApache::OWA was written by Svante Sörmark and was named originally after the Oracle Web Application server, which has since morphed into Oracle iAS. Apache::OWA's mission is to give Apache direct access to Oracle Corporation's PL/SQL Web Toolkit. These packages ship automatically with later Oracle servers, from Oracle Version 8.1.7 onward, and they allow PL/SQL programs to create web content. Although this module is not obviously aimed squarely at Oracle DBAs, we've included it for several reasons:
You can find out more about Apache::OWA from the following web sites: The main packages in the PL/SQL Web Toolkit are described in the following list.
For more information about these packages, check out http://technet.oracle.com — in particular, pages like the following: 5.2.1 Installing Apache::OWA on UnixBefore installing Apache::OWA, you should be aware that this module relies upon the presence of another module called Apache::Request, which lives on CPAN under the name libapreq. You can get this module from: Apache::Request was developed by Jim Winstead and mimics the abilities of CGI.pm to deal with GET and POST program parameters. However, it does this in a quicker way for Apache/Perl modules, giving Apache::OWA more execution speed. To improve performance even more, we recommend that you install Apache::DBI for use with Apache::OWA. The Perl modules contained within the generic Apache::Request library make use of the underlying libapreq C library. They're installed as follows: $ gzip -d libapreq-1.0.tar.gz $ tar xvf libapreq-1.0.tar $ cd libapreq-1.0 $ vi README INSTALL $ perl Makefile.PL $ make $ make test $ make install (Make sure to check out the README and INSTALL files with libapreq, particularly on Solaris 8 and Red Hat Linux. There were some issues noted with Version 0.31, although Version 1.0 should have resolved them.) We can now download and install Apache::OWA proper. We got hold of the Apache-OWA-0.7.tar.gz tarball from the following site: Apache::OWA bends the old conventions a little by naming its unpack directory differently from the download tarball, but hey, we like a little individuality to break up these installation runs. Also note that the make test step was a little skimpy with our tarball, though this may have changed by the time you come to download your own latest version. Let's work through the steps: $ gzip -d Apache-OWA-0.7.tar.gz
$ tar xvf Apache-OWA-0.7.tar
$ cd OWA
$ vi README
$ perl Makefile.PL
$ make
$ make test # May be a little skimpy, just yet! :-)
$ make install
That should be it. Now let's try the same under Win32. 5.2.2 Installing Apache::OWA on Win32Once again, those great folks at ActiveState have done us proud. Just start up a command console while connected to the Internet, and then click in about 50 letters. We'll highlight the places you actually have to type: C:\Perl\site\lib\Apache> ppm PPM interactive shell (2.1.5) - type 'help' for available commands. PPM> install libapreq Install package 'libapreq?' (y/N): y ... Writing C:\Perl\site\lib\auto\libapreq\.packlist PPM> install Apache-OWA Install package 'Apache-OWA?' (y/N): y ... Writing C:\Perl\site\lib\auto\Apache\OWA\.packlist PPM> quit 5.2.3 Configuring Apache::OWAThose who have wrestled in the past with the various Oracle Webserver products and their sometimes cumbersome administration suites will appreciate how minutely scaled the same process is for Apache::OWA in comparison. It's the size of The Incredible Shrinking Man at the end of the film, when he escapes from the spider (i.e., very small indeed). We simply edit httpd.conf, to create a DAD (Database Access Descriptor). Follow these steps:
As an example of how Apache::OWA works, let's take the first simple configuration we worked through preceding, and insert it into our httpd.conf file. We created the HelloApacheOWA procedure in Example 5-6, under scott: Example 5-6. HelloApacheOWA.sqlcreate or replace procedure HelloApacheOWA as cursor curs_dept is select deptno, dname, loc from dept order by deptno; begin htp.htmlOpen; htp.headOpen; htp.title('Apache::OWA, Perl Apache Module for Oracle PL/SQL'); htp.headClose; htp.bodyOpen( cattributes => ' bgcolor="WHITE" ' ); htp.centerOpen; htp.header(1, 'Hello Apache::OWA! :-)'); htp.hr; htp.tableOpen( cattributes => ' border="2" width="80%" '); htp.tableRowOpen; htp.tableHeader( 'Department Number' ); htp.tableHeader( 'Department Name' ); htp.tableHeader( 'City Location' ); htp.tableRowClose; for rec_dept in curs_dept loop htp.tableRowOpen; htp.tableData(rec_dept.deptno); htp.tableData(rec_dept.dname); htp.tableData(rec_dept.loc); htp.tableRowClose; end loop; htp.tableClose; htp.hr; htp.centerClose; htp.bodyClose; htp.htmlClose; end; When we call this procedure via the browser, it generates the output in Figure 5-5. At this point, you may already be thinking of a hundred ways you could expand your own usage of mod_perl and Apache::OWA to create the mother of all remote DBA web toolkits, driven by Perl and PL/SQL. Go for it! Figure 5-5. Apache::OWA calls PL/SQL |