User manual

out.println("<BR>SQLException: " + e +
"</BODY></HTML>");
}
finally
{
try {
if (rs != null)
rs.close();
if (stat != null)
stat.close();
if (conn != null)
conn.close();
}
catch (Exception e2) {
e2.printStackTrace();
}
// close the output stream.
out.close();
}
}
/**
* This method destroys the servlet free resources.
*/
public void destroy()
{
// Servlet is being unloaded, free resources here
}
}
16.2.3 CGI Upload (upload.pl)
#!/usr/local/bin/perl
#uploads file to webserver, uploads phonebook to oracle database, and
executes other perl files (functionalities explained below)
use CGI;
my $cgi = new CGI;
my $dir = $cgi->param('dir');
my $file = $cgi->param('file');
$file=~m/^.*(\\|\/)(.*)/; # strip the remote path and keep the filename
my $name = $2;
open(LOCAL, ">upload.csv") or die $!;
while(<$file>) {
print LOCAL $_;
}
#redirects webpage
print "Location: http://students.engr.scu.edu/~wle/test.html\n\n";
#inserts phone number into beginning of each line in csv file for
upload to database
`perl insertnum.pl upload.csv 4083187087`;
#parses csv file and uploads to oracle database
`rsh server9 ". /usr/local/scripts/setup.oracle.sh; cd
/webpages/wle/cgi-bin/; sqlldr wle/wle control=controlfile.ctl skip = 1;
touch ANOTHER.txt"`;
#removes numbers that were inserted earlier in the csv file
`perl rmnum.pl upload.csv`;
54