Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Using dbms_pipe

Using dbms_pipe

From: Kenneth C Stahl <BluesSax_at_Unforgettable.com>
Date: Tue, 17 Aug 1999 13:40:30 -0400
Message-ID: <37B99E8D.F521BBF2@Unforgettable.com>


For quite some time, several of us on the Oracle forums have been saying that for a variety of situations the answer is to use dbms_pipe. However, it is one thing to talk about it, it is another thing to show how this is done.

I finally got around to writing a small application which illustrates how this is done and the files are attached. Here is how they are used:

cr_sender.sql - Run this script to create a package called Sender. pipelisten.pc - Compile this pro-c program and then run it in the background. You can

                       either redirect the output or just let it be
displayed on the screen.
testsend.sql - Run this pl/sql script when pipelisten is running to send a string to an
                       implicit pipe

goodbye.sql - Run this pl/sql script to tell pipelisten to exit.

All of these assume a default login. If you don't want to use a default login then run the sql scripts with whatever login you want to use and make the appropriate change to the pro-c program to use that login.

Normal caveats apply - this program has not been exercised in a variety of environments and may not work properly in all cases. It doesn't have a great deal of error checking, so it is conceivable that it could have problems in some circumstances.

The pipes used is an implicit pipe which is identified by 'orasend'. It is conceivable that you may wish to use an explicit pipe. If you go that route then just follow the documentation for dbms_pipe.

This isn't real fancy. It only illustrates a very basic technique. However, I hope you can see that if you can send a string through a pipe, you can do virtually anything you want with that string once it is received by the listener. You could even, conceivably, pass a full command line and then execute it with system(). Or perhaps you could send a specific numeric string that can be interpreted to perform a specific function. The possabilities are probably limitless. The only thing that you may want to think about is that there is a slight delay between the time that the message is placed on the pipe and when it is received - a second or two from my calculations.

So, give it a try and enjoy.

Ken


Received on Tue Aug 17 1999 - 12:40:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US