Re: Informix Insert Command in CGI
Posted in 1998
Topics: Server Administration
Elton Hughes wrote:
> As you can tell from the subject, this question is very unique. I have
> written a cgi script in PERL that takes data from a form. It then creates
> an Informix 'INSERT INTO' SQL statement and writes it to disk. Then the
> script executes the SQL statement and finishes by removing the script.
>
> Unfortunately it does not work. The script fails to actually execute the
> SQL statement. The error log gives the following message:
>
> 'isql command' failed at /home1/httpd_1.5.2a/cgi-bin/berkdata.cgi line 101.
I execute simple CGI - Perl - Informix statements by passing a command
line parameter to a shell script which sets all my environment
variables. Works peachy:
--------------
ienv.sh:
--------------
#!/bin/sh
DBCENTURY=C
INFORMIXDIR=/usr/local/informix
INFORMIXSERVER=qsmdb
INFORMIXBIN=/usr/local/informix/bin
INFORMIXTERM=terminfo
ONCONFIG=onconfigexport DBCENTURY INFORMIXDIR INFORMIXSERVER INFORMIXBIN INFORMIXTERM
ONCONFIG
PATH=$PATH:$INFORMIXDIR/bin:/usr/local/bin ; export PATHecho $1 | /usr/local/informix/bin/dbaccess vortex
--------------
Then Perl runs:
`ienv.sh "insert into tab1 values ('whatever');"` or die "Curse!!!";
I totally faked this syntax, but you get the idea...
HTH,
j
--
Jay Hannah
Quality Service Management, Inc.
[v:] 402/397-7077 x29 [f:] 402/397-7576 [p:] 402/899-1793