•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 455,974 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,754 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 1623 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
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 procedure is going to return either Success / Failed output. Can anybody tell me where I am messing up.
Code: ( text )
#!/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 dt is -$dt-
if [ "$dt" != "Success" ]
then
#some error action
exit 0
fi
Code: ( text )
#!/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 dt is -$dt-
if [ "$dt" != "Success" ]
then
#some error action
exit 0
fi
•
•
Join Date: Oct 2007
Posts: 302
Reputation:
Rep Power: 2
Solved Threads: 29
Re: Unable to capture sql output using shell script while running it through browser
#2
Dec 1st, 2007
Hey There
I don't see in the script where the Oracle environment is being sourced into the script. Do you run this on the command line as Oracle when it works?
Probably, if you added a line near that top, like:
. /home/oracle/.profile
The space between the dot and the profile is important. That might do it for you.
Hope that helps
, Mike
I don't see in the script where the Oracle environment is being sourced into the script. Do you run this on the command line as Oracle when it works?
Probably, if you added a line near that top, like:
. /home/oracle/.profile
The space between the dot and the profile is important. That might do it for you.
Hope that helps

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
ajax animations apple asp beta bon browser database developer development echo email encryption firefox flash hacker interactivity. internet microsoft mobile mozilla msdn multimedia news nintendo office opera patch pda privacy safari scripting security software spoof sql survey testing url vista web web development webmail wii windows
- Previous Thread: Bash Shell Script - sales/product/cost
- Next Thread: i need help!


Linear Mode