#!/appl/perl-5.6.1/bin/perl no warnings 'recursion'; use DBI; use CGI::Carp qw(fatalsToBrowser); use CGI; use FileHandle; $ichs_cfg{shlib_path} = "/usr/oracle_cl8.1.6/lib:/usr/lib:/lib:"; $ichs_cfg{oracle_home} = "/usr/oracle_cl8.1.6"; $ichs_cfg{two_task} = "prch"; $ichs_cfg{tns_admin} = "/home/oracle/tnsnames"; #Next we set some environment variables. #I don't fully understand the need for some of these either, but it works. $ENV{"LD_RUN_PATH"} ="/usr/oracle_cl8.1.6/lib"; $ENV{"SHLIB_PATH"} = $ichs_cfg{shlib_path}; $ENV{"TWO_TASK"} = $ichs_cfg{two_task}; $ENV{"ORACLE_HOME"} = $ichs_cfg{oracle_home}; $ENV{"TNS_ADMIN"} = $ichs_cfg{tns_admin}; eval "use Oraperl"; $mycgi = CGI->new(); #### #Modified by JB54 to include logname parameter (random number) for each transaction. File locks were becoming a latency issue. $WWW_tempemp = $mycgi->param("tempemp"); $WWW_logname = $mycgi->param("logname"); $ichs_logs = "/data01/websites/ams/ichs/doc/logs/$WWW_logname.log"; $fh = new FileHandle $ichs_logs, "w"; #defined $fh print {$fh} "Select PL running. \n"; print {$fh} "$WWW_tempemp \n"; print {$fh} "$WWW_logname \n"; my $curDriver; my $db = DBI->connect("dbi:Oracle:prch", "User", "PW"); #Added print {fh} and $DBI::errstr\n to die for debugging ($db) || die(print {$fh} "Database did not connect.\n $DBI::errstr\n"); #### print {$fh} "Database connected...To select users\n"; #### $sql = "select * from sysadm.logon_p01 where clock = upper('$WWW_tempemp')"; print {$fh} "$sql....\n"; $sth = $db->prepare($sql) || die "Can't prepare: $DBI::errstr"; $rc = $sth->execute || die "Can't execute: $DBI::errstr"; #Retrieve data from select statement #Get single row of data returned from oracle. ($clock,$name,$firstname,$middleinitial,$deptid,$phone,$entrydate, $removedate,$location,$pageprogress,$course_start_date,$course_comp_date, $final_quiz_complete,$final_quiz_score,$quiz_attempts,$survey_1,$survey_2, $survey_3,$survey_4,$survey5,$survey_6,$survey_7,$survey_8,$survey_9,$survey_10, $eval_1,$eval_2,$existing_user) = $sth->fetchrow_array; print {$fh} "$clock\n$name\n$firstname\n$middleinitial\n$deptid\n$phone\n$entrydate\n"; print {$fh} "$removedate\n$location\n$pageprogress\n$course_start_date\n$course_comp_date\n"; print {$fh} "$final_quiz_complete\n$final_quiz_score\n$quiz_attempts\n$survey_1\n$survey_2\n"; print {$fh} "$survey_3\n$survey_4\n$survey5\n$survey_6\n$survey_7\n$survey_8\n$survey_9\n$survey_10\n"; print {$fh} "$eval_1\n$eval_2\n$existing_user\n"; #Check for problems during fetch warn $DBI::errstr if $DBI::err; #Disconnect $rc = $db->disconnect || warn $db->errstr; print {$fh} "disconnecting....\n"; undef $fh; chmod(0666,$ichs_logs); #print "Content-Type: text/plain\n\n"; #print ""; exit $status