DB Systems FAQ page

FALL 2004 DATABASE SYSTEMS
USEFUL TIDBITS, AND ANSWERS TO FREQUENTLY ASKED QUESTIONS

Check this page now and then for Oracle tips, content review and useful hints.

THE TOPICS...


Perl on DBase/HW3

I gave the wrong address for accessing cgi-bin scripts! The correct address is this:
http://dbase.cs.jhu.edu:8080/cgi-bin/cgiwrap/alamora/example.pl

This calls the Perl script example.pl, which resides at ~alamora/public_html/cgi-bin/example.pl

The helpful script found at
Ryan Brown's page (referenced from hw3h.html) is configured for debug mode only. To try the form in 'release mode', you need to make a few modifications; first, modify variables for your account, and second, get rid of the STDERR messages (which causes Apache to think it's something other than HTML). The STDERR messages are fine for scripts called from the command line, but not for web interaction.

Here are the changes, in bold italics:
  • Change the user name to yours:
    # -- first let's connect to the database and set everything up:
    # set your $username and $password before making this call:
    $username = "alamora_03";
    $password = "lemmein2ora";

  • Comment out (with the # sign) this statement (like so):
    #print STDERR "Connecting to Oracle.\n";


  • And the one just a few lines below it too:
    #print STDERR "Connected.. processing input.\n";


  • Now fix the errant link (replace bold italics with your dbase Unix account):

    $myurl = "http://dbase.cs.jhu.edu:8080/cgi-bin/cgiwrap/alamora/example.pl";
    (later, replace example.pl with your own perl file)


  • Then lastly, in the insert function (though this one may not be really necessary):
    #print STDERR "sql: $query_string\n";

Final note - this example is fairly extensive and uses html forms. Your solution, on the other hand, will not use forms, but will instead accept data directly from standard input (you wont call it through the web).


CGI Debug Mode
You can view debug data on your CGI script through this address:
http://dbase.cs.jhu.edu:8080/cgi-bin/cgiwrapd/<youraccount>/<yourscript>


Working with sql files

Use vi. You can create files in your home directory, then run them from sqlplus using the @ (or start) command.
A particularly useful technique is to start from oracle, and "drop" to your command shell using the bang:
SQL> ! vi mysqlfile.sql
edit away...
:wq
... and now you're back in SQL ...
SQL>@mysqlfile this runs your new file
OR! You use the ever-handy shell to run your sql for you like this...
shell--> cat mysqlfile.sql |sqlplus user/password >> output.txt
(but beware that this is insecure... )

Of course, you can always just copy from a windows-esque editor, and paste into sqlplus too.

Last Updated: 11/16/2004
Copyright Andrew LaMora The Johns Hopkins University 3400 N. Charles St. Baltimore, MD 21218