473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Unable to capture sql output using shell script while running it through browser

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 procedure is going to return either Success / Failed output. Can anybody tell me where I am messing up.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/ksh
  2.  
  3. if [ $REQUEST_METHOD == "POST" ]
  4. then
  5.         QUERY_STRING=`line <&0`
  6. fi
  7.  
  8. export TEMP_STRING=$QUERY_STRING
  9.  
  10. User_ID=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) {if($i ~ /userid/) {print $i;} } }' | cut -f2 -d'='`
  11.  
  12. SCRN_Token=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) { if($i ~ /scrntoken/) {print $i;} } }' | cut -f2 -d'='`
  13.  
  14. SQLPLUS=`which sqlplus`
  15. FMUSER=username
  16. FMPASS=password
  17. FMSID=orasid
  18.  
  19. REMOTE_ADDR=`env | grep "REMOTE_ADDR" | cut -f2 -d'='`
  20. NewToken="${REMOTE_ADDR}${User_ID}"
  21.  
  22. dt=`$SQLPLUS -s $FMUSER/$FMPASS@$FMSID <<EOF
  23. set head off
  24. set pagesize 0
  25. set feedback off
  26. set serveroutput on feedback off
  27. exec validate_fm_user('$SCRN_Token', '$NewToken')
  28. quit
  29. EOF`
  30.  
  31. echo dt is -$dt-
  32.  
  33. if [ "$dt" != "Success" ]
  34. then
  35. #some error action
  36. exit 0
  37. fi
  38.  
Nov 28 '07 #1
1 4358
numberwhun
3,509 Expert Mod 2GB
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 procedure is going to return either Success / Failed output. Can anybody tell me where I am messing up.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/ksh
  2.  
  3. if [ $REQUEST_METHOD == "POST" ]
  4. then
  5.         QUERY_STRING=`line <&0`
  6. fi
  7.  
  8. export TEMP_STRING=$QUERY_STRING
  9.  
  10. User_ID=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) {if($i ~ /userid/) {print $i;} } }' | cut -f2 -d'='`
  11.  
  12. SCRN_Token=`echo $TEMP_STRING | awk 'BEGIN {FS="&"} { for (i=1; i<=NF; i++) { if($i ~ /scrntoken/) {print $i;} } }' | cut -f2 -d'='`
  13.  
  14. SQLPLUS=`which sqlplus`
  15. FMUSER=username
  16. FMPASS=password
  17. FMSID=orasid
  18.  
  19. REMOTE_ADDR=`env | grep "REMOTE_ADDR" | cut -f2 -d'='`
  20. NewToken="${REMOTE_ADDR}${User_ID}"
  21.  
  22. dt=`$SQLPLUS -s $FMUSER/$FMPASS@$FMSID <<EOF
  23. set head off
  24. set pagesize 0
  25. set feedback off
  26. set serveroutput on feedback off
  27. exec validate_fm_user('$SCRN_Token', '$NewToken')
  28. quit
  29. EOF`
  30.  
  31. echo dt is -$dt-
  32.  
  33. if [ "$dt" != "Success" ]
  34. then
  35. #some error action
  36. exit 0
  37. fi
  38.  
This is the Perl forum, for Perl coding questions. This question better belongs in the Unix Forum as Shell scripting is done on Unix. I am moving this thread over there.

Regards,

Jeff
Nov 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: bertoulin | last post by:
When I run my script via the shell (e.g. "php test.php") the script generates the correct output everytime. If I attempt to access the script via the web (e.g. http://localhost/test.php), Apache...
1
by: Pawel Banys | last post by:
Hello, There is an operation which can be performed at the shell prompt the following way: some_prg > result_file However, before "some_prg" can use files, they have to be converted and...
10
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able...
8
by: standish22 | last post by:
I want to programmatically capture an error that is done from a Shell command in VB.Net code. What I have is a Test.sql file that looks like ---------------------------------------------------...
2
by: Gerard Flanagan | last post by:
Hello, I have a third party shell script which updates multiple environment values, and I want to investigate (and ultimately capture to python) the environment state after the script has run....
16
by: Okonita via DBMonster.com | last post by:
Hi all, I am comming along with all this Linus/DB2/scripting business...I am no longer scared of it!! (LOL). But, I need to create a .ksh script that does a REORGCHK and output only tables...
1
by: mlaris | last post by:
Howdy, We are experiencing a bizarre problem under Linux attempting to restore a DB2 database. The backup was created on this machine, and is being restored to the same machine, but changing the...
4
by: mbatestblrock | last post by:
I hope this makes some sense. My ultimate goal here is to execute a block of code if the mouse has not moved in a minute or so within the broswer. The machine I am running this on is for internal...
5
by: vasilis | last post by:
I have a list box in a site with which I capture a selected value with the onChange event using the capture_value() function (code listed below). This function passes 2 arguments, i.e., 'str' which...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.