Re: Calling a UNIX system call from Forms 5.0

From: Tom Zamani <tomz_at_redflex.com.au>
Date: Thu, 20 Apr 2000 13:44:28 +1000
Message-ID: <8dlur9$a2c$1_at_perki.connect.com.au>


In term of permissions well it needs execute. on the shared object as for Oracle wrapper function as you can see the format of the function is different from you ordinery function.
that is because it will be using different listener.If you look at the server files you see there is anothre listener (exproc) running, which will take care of the external procedures.
in this example

> > Function SYSRUN

this is the functions name, could be anything .
> > ( syscomm IN varchar2)

the command which needs to be executed in you case it would be the host name
> > RETURN binary_integer AS external
 return type of the c function which is what you need ( your function will return a integer) look at oracle doc for data mapping)
> > LANGUAGE C
> > NAME "ifhostfound"

This is the name of c function ()
> > LIBRARY shell_lib;

This is the oracle library which is pointing to you shared object.

Tom

<sanjaykuriyal_at_my-deja.com> wrote in message news:8dks4v$1uo$1_at_nnrp1.deja.com...
> Tom,
> Thanks a bunch for the valued information.
>
> Just to update you,
> I'd like to give you some more details.
> The oracle database version is 8.0.5.1.0 and it runs on a sun solaris
> unix server.
> The C function I created looks like this : please ignore the main
> function . that was for testing purpose.
>
> #include <sys/types.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <netdb.h>
>
> /*main(int argc , char **argv)
> {
> printf("Hostname is %s\n",argv[1]);
> if(ifhostfound(argv[1]))
> printf("Host found\n");
> else
> printf(" Host does not exist\n");
>
> }
> */
>
> int ifhostfound(char *hostname)
> {
> struct hostent *hostip;
> hostip = gethostbyname(hostname);
> if(hostip==NULL)
> return 0;
> else
> return 1;
>
> }
>
> I compiled the code to make an object file.
> I did not make it a shared object. Which I will.
> Could you please tell me more about an oracle wrapper function?
> The C function I created is in my home directory on the unix machine.
> what permission do i set on it?
> Thanks Again
> Sanjay
>
>
> In article <8dj7vs$1tq$1_at_perki.connect.com.au>,
> "Tom Zamani" <tomz_at_redflex.com.au> wrote:
> > use External procedure call, from oracle DB, ORacle 8.1.6 has its own
> > pakage for external procedure call.
> > but if you are using 8.X then External procedure call is the way.
> > if your DB is less than 8 then I am not sure.
> >
> > create a C function which executes system (input command output
> number)
> > make an object filr cc -c Myfunction.c -o Myfunction.o
> > make a shared object ld -G Myfunction.o -o Myfunction.so
> >
> > in oracle create a library pointing to the Myfuntion.so
> > create library Mylib as 'full path to Myfunction.so'
> > create an oracle wrapper function
> > Some thing like this
> > Function SYSRUN
> > ( syscomm IN varchar2)
> > RETURN binary_integer AS external
> > LANGUAGE C
> > NAME "sysrun"
> > LIBRARY shell_lib;
> >
> > then by using a PLSQL procedure execute this function.
> > Tom
> >
> > Tom
> > <sanjaykuriyal_at_my-deja.com> wrote in message
> > news:8dir8l$q52$1_at_nnrp1.deja.com...
> > > Hello,
> > >
> > > I need to use the unix system call gethostbyname from Forms 5.0. Is
> > > there any library or any other way in which I can call a unix system
> > > call. If No, is there any way I can call a C executable from Form
> 5.0.
> > > like ora_ffi or user_exit. If so please help me with the detail
> > > procedure to go through it.
> > > I have Forms 5.0 running on a windows NT workstation.
> > >
> > > Thanks in advance.
> > > Sanjay
> > >
> > >
> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.
> >
> >
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Thu Apr 20 2000 - 05:44:28 CEST

Original text of this message