Running .4ge's through the SYSTEM command in a stored procedure
Posted in 2003
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Server Administration, Platform-Specific Issues
Just like to share a work around for the following problem.
We have an application which connects to our IDS (7.31.UD4) database
on our Unix machine (HP-UX 11.11) via ODBC (IBM Informix 3.82 32 bit).
It kicks off a stored procedure which in turn runs a SYSTEM command to
run a script and passes a parameter. The script changes directory and
is suppose to run the .4ge and finally echos the parameter to a text
file.
PROCEDURE:
CREATE PROCEDURE "rpears".run_activity(repid CHAR(40))
DEFINE l_str CHAR(100);
LET l_str = '/elite/mis_support/d_progs/activity.bat "' || repid ||
'"';
SYSTEM l_str;
END PROCEDURE;
The SYSTEM command does execute the script as the text file contains
the parameter passed, but the .4ge does not execute at all (it should
insert records into a table based upon the parameter passed). You can
execute the procedure through dbaccess and everything is fine. It
isn't a permission issue as we have tried connecting as root with no
affect.
However, I tried echoing the .4ge to the "at" command in the script -
ACTIVITY.BAT:
echo "/elite/mis_support/d_progs/activity.4ge $1" | at -m now
echo $1 >> /elite/mis_support/d_progs/activtest.txt
exit 0
and this worked!
IBM Informix are still looking into why I cannot run the .4ge
directly.
Hope this helps any of you in the same position.