Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

External Procedures

Status
Not open for further replies.

silvia23

Technical User
May 22, 2003
26
ES
Hello,
I need to use an external dll with a method in C. In order to do that, I've done the following steps:

1.- Generate the DLL with the export function inside:
__declspec(dllexport) int __cdecl CFunc(int seed)
{
...
}


2.- Create a PL/SQL Library

CREATE OR REPLACE LIBRARY mylib IS
'C:\ORANT\PLSQL80\MyDLL.dll';


3.- Create a script to call external functions:

CREATE or REPLACE FUNCTION rand (
seed INTEGER)
RETURN INTEGER AS EXTERNAL
LIBRARY mylib
NAME "CFunct"
LANGUAGE C;
/

CREATE or REPLACE PROCEDURE run_demo IS
al INTEGER;
BEGIN
begin
al := rand(100);
...
exception when others
then
dbms_output.put_line('SQL Error: ' || sqlerrm);
end;
end;
/

But when I call the procedure an error occur:
SQL> execute run_demo;
SQL Error: ORA-28575: no se ha podido abrir la conexión RPC con el agente de procedimiento externo

If necessary change something to file tnsnames.ora?¿
Thanks a lot,
Silvia
 
Hi Silvia

I had the same problem a while back and I added an extproc_connection_data parameter to my tnsnames file, this seemed to clear up the problem for me. There is lots of info on this error on metalink.

HTH

James
 
Thanks a lot!!!
The initial problem was solved configuring the files tnsnames.ora and listener.ora, but a new problem has appeared:

SQL> exec run_demo;
SQL Error: ORA-06521: PL/SQL: Error al crear la correspondencia de la función
ORA-06522: Unable to
load symbol from DLL

Procedimiento PL/SQL terminado con éxito.

What mechanism is used by Oracle to map the functions?¿ Because when I try to call an internal function belonged to an Oracle package the same error appear.
Any idea?¿
Thanks again,
Silvia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top