Unable to capture pl/sql dbms_output using shell script while running it through browser [message #284041] |
Wed, 28 November 2007 11:08 |
samba_siva_raju
Messages: 3 Registered: November 2007
|
Junior Member |
|
|
Hi,
I am not sure whether I am posting it in right location as i cant see any shell scripting forum here. Below script works perfectly fine from command line, but when I run through browser I am not getting anything inside my $dt. Because of this its always going inside failure scenario. My pl/sql procedure is going to return either Success / Failed as dbms_output. Can anybody tell me where I am messing up.
#!/usr/bin/ksh
if [ $REQUEST_METHOD == "POST" ]
then
QUERY_STRING=`line <&0`
fi
export TEMP_STRING=$QUERY_STRING
User_ID=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) {if($i ~ /userid/) {print $i;} } }' | cut -f2 -d'='`
SCRN_Token=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) { if($i ~ /scrntoken/) {print $i;} } }' | cut -f2 -d'='`
SQLPLUS=`which sqlplus`
FMUSER=username
FMPASS=password
FMSID=orasid
REMOTE_ADDR=`env | grep "REMOTE_ADDR" | cut -f2 -d'='`
NewToken="${REMOTE_ADDR}${User_ID}"
dt=`$SQLPLUS -s $FMUSER/$FMPASS@$FMSID <<EOF
set head off
set pagesize 0
set feedback off
set serveroutput on feedback off
exec validate_fm_user('$SCRN_Token', '$NewToken')
quit
EOF`
echo "Response : $dt"
if [ "$dt" != "Success" ]
then
#some action for failure
exit 0
fi
|
|
|
|
|
|
|
Re: Unable to capture pl/sql dbms_output using shell script while running it through browser [message #284069 is a reply to message #284051] |
Wed, 28 November 2007 14:17 |
Ronald Beck
Messages: 121 Registered: February 2003
|
Senior Member |
|
|
First, try what anacedent says to do and inspect the environment that your web server is running under. Just because YOU can run the script when you log in (because your environment is set) doesn't mean the web server USER has the right environment settings. A web page isn't run as you, it's run as the user who started the server daemon.
Another option would be to hard-code the path to the sqlplus command and see if that works for you. I too suspect that your web server user PATH variable does not include $ORACLE_HOME/bin/sqlplus.
Good luck!
Ron
|
|
|
|
|