Home » Infrastructure » Windows » Problem while executing a dll throuch External Procedure (merged) (Oracle8i)
icon4.gif  Problem while executing a dll throuch External Procedure (merged) [message #449347] Mon, 29 March 2010 04:51 Go to next message
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 Go to previous messageGo to next message
John Watson
Messages: 8922
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?
Re: Problem while executing a .dll through External Procedure [message #449546 is a reply to message #449455] Tue, 30 March 2010 06:46 Go to previous messageGo to next message
Member24
Messages: 3
Registered: March 2010
Junior Member
Hi John,

Thanks for your reply. My requirement is to open an oracle form URL (to upload documents from client system to server using webutil). To call that form i am executing the external procedure.

Please let me know if you find any solution for this.

Thanks,

Re: Problem while executing a dll throuch External Procedure [message #449815 is a reply to message #449347] Thu, 01 April 2010 02:28 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is useless to repeat the same question and in the wrong forum: the topics will be merged and you will not get more answer.

Read OraFAQ Forum Guide from top to bottom.

Regards
Michel

[Updated on: Thu, 01 April 2010 02:30]

Report message to a moderator

Re: Problem while executing a dll through External Procedure [message #449817 is a reply to message #449815] Thu, 01 April 2010 02:35 Go to previous messageGo to next message
Member24
Messages: 3
Registered: March 2010
Junior Member
Oh.. I dint know that. I registered recently... While posting this problem i chose "Windows" forum. Now i am neither able to delete the post nor change to another forum...

Thanks for your reply..
Re: Problem while executing a dll through External Procedure [message #449822 is a reply to message #449817] Thu, 01 April 2010 03:07 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
They have been merged here and duplicate has been removed.

Regards
Michel
Previous Topic: TNS protocol adapter error when ;log in sqlplus for oralce 11g client for window 7(64 bit)
Next Topic: Oracle 9i installation
Goto Forum:
  


Current Time: Thu Mar 28 13:22:53 CDT 2024