Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help: system call inside stored procedure

541 views
Skip to first unread message

Low Chee Meng

unread,
Nov 2, 1993, 10:33:40 PM11/2/93
to
Hi,

I'm having problems make the SYSTEM call work inside a stored
procedure.

For example,

create procedure echo1(msg char(80))
system "/usr/bin/echo msg";
return;
end procedure

When I do a execute procedure echo1("hello world"),
I got back this error message:

668: System command cannot be executed
1: Not owner

Anybody has any idea what is happening here?

I'm using Informix 5 on a Sparc 10 with SunOS 4.1.3.

Regards and thanks in advance,

Chee Meng

--
---------------------------------------------------------------------
Chee-Meng Low (cm...@iti.gov.sg) (fax: 65-777-3043)
Information Technology Institute, Singapore
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Jonathan Leffler

unread,
Nov 3, 1993, 11:08:07 AM11/3/93
to
>From: cm...@iti.gov.sg (Low Chee Meng)
>Subject: Help: system call inside stored procedure
>Date: Wed, 3 Nov 1993 03:33:40 GMT
>X-Informix-List-Id: <news.4779>

>
>I'm having problems make the SYSTEM call work inside a stored procedure.
>For example,
>
>create procedure echo1(msg char(80))
>system "/usr/bin/echo msg";
>return;
>end procedure
>
>When I do a execute procedure echo1("hello world"),
>I got back this error message:
>
>668: System command cannot be executed
> 1: Not owner
>
>Anybody has any idea what is happening here?
>I'm using Informix 5 on a Sparc 10 with SunOS 4.1.3.

I just tried your procedure using OnLine 5.01.UC1 on SunOS 4.1.3 and had no
trouble with any error messages. Obvious things to check: you have execute
permission on /usr/bin/echo (I thought so), and your shell can also be
handled run by a sgid informix program?

Also, to get anything remotely resembling the desired effect, you are
going to need to do:

create procedure echo2(msg char(80))
define cmd char(100);
let cmd = "/usr/bin/echo " || msg;
system cmd;
return;
end procedure;

Finally, do you know where the standard output of echo is going? I don't.
I can tell you several places it isn't going, though, and one of them is
the standard output of the program executing the stored procedure, and
another is the standard output of the engine. If you want to get the
message to the terminal, try redirecting to /dev/tty, but that won't work
in a network connection.

Only use system to log incidents in known log files, and things like that.
And don't forget that it will be quite slow -- as slow as any other
fork/exec which does nothing very much -- but you may end up calling the
SP quite often.

Yours,
Jonathan Leffler (jo...@informix.com) #include <disclaimer.h>

Dave Kosenko

unread,
Nov 9, 1993, 1:41:14 PM11/9/93
to

Low Chee Meng asked:

|> >I'm having problems make the SYSTEM call work inside a stored procedure.
|> >For example,
|> >
|> >create procedure echo1(msg char(80))
|> >system "/usr/bin/echo msg";
|> >return;
|> >end procedure
|> >
|> >When I do a execute procedure echo1("hello world"),
|> >I got back this error message:
|> >
|> >668: System command cannot be executed
|> > 1: Not owner
|> >
|> >Anybody has any idea what is happening here?

Jonathan Leffler writes:
|> I just tried your procedure using OnLine 5.01.UC1 on SunOS 4.1.3 and had no
|> trouble with any error messages. Obvious things to check: you have execute
|> permission on /usr/bin/echo (I thought so), and your shell can also be
|> handled run by a sgid informix program?

Also check the permissions on $INFORMIXDIR/bin/sgidsh, which should be:
-rwsr-sr-x 1 root informix 172032 Jun 22 1992 bin/sgidsh

Dave
Disclaimer: These opinions are not those of Informix Software, Inc.
**************************************************************************
"I look back with some satisfaction on what an idiot I was when I was 25,
but when I do that, I'm assuming I'm no longer an idiot." - Andy Rooney

0 new messages