Problem while executing a dll throuch External Procedure (merged) [message #449347] |
Mon, 29 March 2010 04:51 |
Member24
Messages: 3 Registered: March 2010
|
Junior Member |
|
|
Hi,
I am facing problem while executing a .dll through oracle8i.
1) I have written Test.c program to generate Test.dll
__declspec(dllexport) void BatchExec()
{
system("c:\\Test.bat");
}
2) Test.bat file is to open IE.
start iexplore
exit
3) I have written BatchTest.cpp to test Test.dll
#include "stdafx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
HINSTANCE hDLL = NULL;
hDLL = LoadLibrary(TEXT("C:\\Test\\Release\\Test.dll"));
typedef void (__stdcall * integers)();
integers lpfn=(integers)GetProcAddress(hDLL,"BatchExec");
lpfn();
return 0;
}
Through the above program I was able to run Test.dll and IE is opening...
4) I am trying to run Test.dll through External procedure as follows,
sql>create or replace library ext_proc as 'c:\Oracle8i\bin\Test.dll';
sql>CREATE OR REPLACE FUNCTION PLS
RETURN BINARY_INTEGER AS
EXTERNAL LIBRARY ext_proc
NAME "BatchExec"
LANGUAGE C
PARAMETERS (RETURN SHORT);
/
sql>CREATE OR REPLACE PROCEDURE Use AS
res BINARY_INTEGER;
BEGIN
res := PLS;
dbms_output.put_line(res);
END;
sql>set serveroutput on
sql>exec Use;
0
Procedure executed successfully.
After the procedure execution i am not able to see IE. But i can see that in Task Manager\Processes. and extproc is also running. Looks like Test.bat is being executed.!!!
lister.ora and tnsnames.ora configuration looks good.
I was able to execute extern.c which is given in C:\oracle8i\RDBMS\extproc and able to run extern.dll using the procedure given in extern.sql. Finally i was able to find the maximum of two numbers.
Why am i not able to run Test.dll???!!!!
Am i doing anything wrong???
Or cant we open another application through external procedures??
I tried opening Notepad also. But no use....
Please help me out.. I have been working on this since a week. But not able make it work.
Please let me know if you find any changes required.
Thanks in Advance!
[Updated on: Mon, 29 March 2010 08:10] Report message to a moderator
|
|
|
Re: Problem while executing a .dll through External Procedure [message #449455 is a reply to message #449347] |
Mon, 29 March 2010 11:45 |
John Watson
Messages: 8960 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Never mind the detail of your code, are you sure that an external procedure is, architecturally, what you need? A procedure can be invoked from a client user process, but it will run on the server. There is no way you, at the client side, can manipulate a process launched on the server side. Where are you expecting IE to run, and how would you intend to interface with it?
|
|
|
|
|
|
|