Databases Homework 3

Perl & Oracle

The Example:


This part of the Homework 3 assgnment will introduce you to communicating with the Oracle database from your Perl script.

First, take a look at our example perl script. This would be a good starting point (just save a copy in your own directory). It has step-by-step comments and shows you how to:


You will also need to download the cgi-lib.pl library for dealing with cgi forms in Perl. Copy this file and the example.pl script into your:
~/public_html/cgi-bin
... directory on hops/barley/dbase/ugrad*. You will then need to type:
chmod 755 ~/public_html/cgi-bin/*.pl
... to make the two scripts runnable. Then you will also need to make your home directory, public_html directory and cgi-bin directory group executable so the web server can run your script:
chmod g+x ~/
chmod g+x ~/public_html
chmod g+x ~/public_html/cgi-bin

Then, look at the comments in the top of example.pl and create the following table in your table space, using sql*plus:

CREATE TABLE user_info (
   login VARCHAR2(15),
   name VARCHAR2(30),
   email VARCHAR2(80),
   primary key (login));
You will also need to change the username and password variables in the top of the script to your username & password for Oracle. Once the files are in place, the table is created, and your username and password are set, you can try running the script by going to:
http://dbase.cs.jhu.edu:8080/cgi-bin/cgiwrapd/USERNAME/example.pl
Where USERNAME is your hops/barley/ugrad*/dbase username.

Take a look at the script in action, in my directory at: http://dbase.cs.jhu.edu:8080/cgi-bin/cgiwrapd/catalina/example.pl