Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Oracle extproc not working
Hello, I'm having a tremendous problem with getting Oracle to call an
external DLL. I'd be VERY happy if someone could lead me in the right
direction.
I've written a C DLL in Borland C++ 5.0, and placed it in a directory
on the Oracle server. Here is the code for the DLL:
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <process.h>
extern "C" __declspec(dllexport) void UpdateSalary(void) {
int result;
result = spawnl(P_WAIT, "notepad.exe", "notepad.exe", NULL);
} /* UpdateSalary */
I've also created a library and procedure, all of which appears to have been compiled correctly. (Using TOAD, and SQLPlus80)
create or Replace Library proj as 'C:\OCS\kilroy.dll'
/
CREATE OR REPLACE PACKAGE packproj
IS
procedure np1 ;
PRAGMA RESTRICT_REFERENCES (np1,
WNPS, RNPS, WNDS, RNDS);
END packproj;
/
CREATE OR REPLACE PACKAGE BODY packproj
IS
procedure np1 is external
NAME "UpdateSalary"
LIBRARY proj
END packproj;
/
I've even made just a very simple procedure to call this function,
instead of using a package, like this:
procedure MKTest is external
NAME "UpdateSalary"
LIBRARY proj;
/
execute Mktest
--OR
execute PackProj.np1;
but I continue to get errors such as:
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function ORA-06522: Unable to load symbol from DLL ORA-06512: at "PAN.MKTEST", line 0 ORA-06512: at line 1
I've gotten other errors that I believe were leading up to this. (I've corrected other things)
I have noticed that the server is running EXTPROCT and EXTPROC in its processes from the task manager.
The linstener.ora contains this:
LISTENER =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.109.109)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.109.109)(PORT = 1526))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = MGT_ORACLE) (SID_NAME = PAN1)
(PROGRAM = extproc) (SID_NAME = TESTextproc)
And the tnsnames.ora contains this:
EXTPROC_CONNECTION_DATA.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(Key = EXTPROC))
(CONNECT_DATA = (SID = TESTextproc))
)
What am I doing wrong? I've compiled the DLL with the extern "C" in
front of the __declspec(dllexport), but still doesn't work.
Is my server set up wrong? Or is the problem in my code for the DLL?
I've been working on this for 2 days, and I'm out of ideas.
Thanks so much for helping...
Dan Jones
dan_jones_at_protelinc.com
Sent via Deja.com
http://www.deja.com/
Received on Fri Feb 09 2001 - 12:58:33 CST
![]() |
![]() |