Re: Calling Form from PL/SQL

From: Peter Larsen <bitdeb_at_hotmail.com>
Date: 2000/03/01
Message-ID: <sbop6ea0jp116_at_corp.supernews.com>#1/1


Dave Briggs wrote:
>
>
> I need to be able to call a form from within a PL/SQL stored procedure.
> Is this something that can easily done?

Definately NOT easy. Recall what Oracle is - at the easiest it's a client/server configuration. Your client is running on a GUI based OS and the database on a high-end server somewhere in the company. Now, the question is, with a PL/SQL is running on the server - which client should then run the form??

Well - it's a problem, but not impossible. But you need to use daemons or services as Windows calls them. Create a daemon on your OS - the daemon could be a standard SQL*Plus session, or a PRO*C program - you decide. But the principle is the same. Your daemon logs onto the database. Then it opens a pipe, and starts listening to it. When it gets a certain command on the pipe - that fits the address it has - it will spawn a process with Oracle Forms opening the form given as parameter in the pipe-command. Then you can choose if the daemon terminates or returns to listening to the pipe.

In your calling application - the PL/SQL that you want to start the Form, you create a command indicating the client (use the site name) that you want to run the Runform command - and the name of the form, it has to open. Then add any other information you find necessary, authoriztion and parameters needed by the form. Open the daemon pipe, and send the message. That should do it.

Remember, multible listeners on the same pipe is possible! So you can more than one client listening, that's why you need the address. If you have a problem with that approach, then just create a pipe that includes the client name, and in that way, you indicate what client will run the form.

Problems: You have users logged on, idle. Your server should use MTS for this approach to work optimal. Then remember, that the daemons are logged on all the time, so shutting down the database becomes difficault - you'll need to use the immediate option on the shutdown if you shut the database down for backups. Additional, you must assure that the daemon is running. If the server goes down, the daemon will loose its connection making it mandatory for it to retry the connection. That part of the code can be tricky, because it's rarly advertised to clients when the server goes down. So a timeout feature must be implemented (pipes can timeout) so you can make sure that the connection is still valid. Hence more network traffic - but you cannot get everything served on one platter .. (hehe).

Alternate, if you want to run the form on the server, create external procedures in the kernel, and let that process SPAWN a new X process that runs the form. However, I don't think that process will work.

Good luck!

--
Posted via CNET Help.com
http://www.help.com/
Received on Wed Mar 01 2000 - 00:00:00 CET

Original text of this message