How to execute system command in SPL via client machine?
Posted in 2000
Topics: Stored Procedures & SPL, Data Types & Schema Design
Dear all,
I have created a SP like this,
create procedure echomsg(msg varchar(20))system 'echo ' || msg || ' >> /tmp/msg ';
end procedure;
and execute the procedure on the same machine.
There's no problem with it, but when I try to do the same thing from another
client machine,
it shows 668: System command cannot be executed. 2: No such file or
directory.
I don't know what happen but I'm very confused about this. What's wrong with
it?
best regards,
Jinyao Lin
Add the 2 lines I inserted below. The output will
probably tell you exactly what the problem is.
In article <8rrl11$q5a1@www.informix.com>,
"Jinyao Lin" <jinyao@mail.com> wrote:
> Dear all,
> I have created a SP like this,
>
> create procedure echomsg(msg varchar(20))
SET DEBUG FILE TO "/tmp/echomsg.trc";
TRACE ON;
> system 'echo ' || msg || ' >> /tmp/msg ';
> end procedure;
>
> and execute the procedure on the same machine.
> There's no problem with it, but when I try to do the same thing from another
> client machine,
> it shows 668: System command cannot be executed. 2: No such file or
> directory.
>
> I don't know what happen but I'm very confused about this. What's wrong with
> it?
>
> best regards,
> Jinyao Lin
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
Jinyao Lin wrote:
> I have created a SP like this,
>
> create procedure echomsg(msg varchar(20))> system 'echo ' || msg || ' >> /tmp/msg ';
> end procedure;
>
> and execute the procedure on the same machine.
> There's no problem with it, but when I try to do the same thing from another
> client machine,
> it shows 668: System command cannot be executed. 2: No such file or
> directory.
>
> I don't know what happen but I'm very confused about this. What's wrong with
> it?
Is your database server on NT? There have been several protracted
discussions of error 668 related to NT. I've not followed them to the
conclusion; I concluded that NT is not my platform of choice long ago.
If you're on Unix, then it is harder to explain the problem.
Permissions is one issue; who created that /tmp/msg file, and what were
the permissions on it? Can everyone who executes the procedure write to
the file? If not, that may be the trouble. Another issue might be the
pathname of the shell which is used. SHELL is one of the environment
variables passed by the connection code, at least when a network
connection to the local machine -- you can verify using
SQLIDEBUG=2:somefile
export SQLIDEBUG
dbaccess database - </dev/null"
unset SQLIDEBUG
sqliprint somefile_[0-9]*
If the remote user is using a shell that does not exist on the database
machine, I can see that maybe you'd get the 668 error.
--
Yours,
Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
"I don't suffer from insanity; I enjoy every minute of it!"
PS: I am assuming a moderately recent release of the servers is
available,
and I am assuming you have a sufficiently recent version of CSDK on the
machine.
Thanks for these help me a lot. I've found problem of that.
This problem occure due to I use Linux as client machine and server is Sun
Solaris,
the Linux use /bin/bash for default SHELL and there's no bash on Sun
Solaris, Therefor it is not possible to execute system command because
system command require SHELL enviroment to execute system command. When I
set SHELL to /bin/sh and re-execute the procedure and I finally works.
Thanks all.
Best regards,
Jinyao Lin
"Jonathan Leffler" <jleffler@informix.com> ?????
news:39E25E05.B1896C1D@informix.com...
> Jinyao Lin wrote:
> > I have created a SP like this,
> >
> > create procedure echomsg(msg varchar(20))> > system 'echo ' || msg || ' >> /tmp/msg ';
> > end procedure;
> >
> > and execute the procedure on the same machine.
> > There's no problem with it, but when I try to do the same thing from
another
> > client machine,
> > it shows 668: System command cannot be executed. 2: No such file or
> > directory.
> >
> > I don't know what happen but I'm very confused about this. What's wrong
with
> > it?
>
> Is your database server on NT? There have been several protracted
> discussions of error 668 related to NT. I've not followed them to the
> conclusion; I concluded that NT is not my platform of choice long ago.
>
> If you're on Unix, then it is harder to explain the problem.
> Permissions is one issue; who created that /tmp/msg file, and what were
> the permissions on it? Can everyone who executes the procedure write to
> the file? If not, that may be the trouble. Another issue might be the
> pathname of the shell which is used. SHELL is one of the environment
> variables passed by the connection code, at least when a network
> connection to the local machine -- you can verify using
>
> SQLIDEBUG=2:somefile
> export SQLIDEBUG
> dbaccess database - </dev/null"
> unset SQLIDEBUG
> sqliprint somefile_[0-9]*
>
> If the remote user is using a shell that does not exist on the database
> machine, I can see that maybe you'd get the 668 error.
>
> --
> Yours,
> Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h>
> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN
> "I don't suffer from insanity; I enjoy every minute of it!"
>
> PS: I am assuming a moderately recent release of the servers is
> available,
> and I am assuming you have a sufficiently recent version of CSDK on the
> machine.