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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Oracle extproc not working

Re: Oracle extproc not working

From: <poppakap_at_my-deja.com>
Date: Fri, 09 Feb 2001 22:36:47 GMT
Message-ID: <961rdv$q6c$1@nnrp1.deja.com>

  I've run the demo that comes with Oracle regarding the extproc. In the DLL I've tried to include things like spawnl Notepad.exe or creating
a file on the disk, but it won't work.
  Ultimately, I want to use a dll as a wrapper to call a Delphi DLL, which will contain a windows form, write to the registry and whatever.

  Why won't the C DLL write to a file or execute a shell app? Is it running under a sacred Oracle thread?
  Did I "pragma" the wrong privelidges to the package?   AACK! In article <961ekj$dud$1_at_nnrp1.deja.com>,   poppakap_at_yahoo.com wrote:
> 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)
> )
> (SID_DESC =
> (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/
>

Sent via Deja.com
http://www.deja.com/ Received on Fri Feb 09 2001 - 16:36:47 CST

Original text of this message

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