Home » SQL & PL/SQL » SQL & PL/SQL » Function Parameters throwing ORA-28576: lost RPC connection to external procedure agent (merged)
icon8.gif  Function Parameters throwing ORA-28576: lost RPC connection to external procedure agent (merged) [message #408746] Wed, 17 June 2009 09:24 Go to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
Hi All,

I wasn't sure where to post this Topic, but I thought it is mostly related to PL/SQL code. The reason I am re-creating a new topic in this forum is that I believe my Problem is a bit different from the other posts related to the same ERROR.

Most of my research showed that this could be a Generic error with Multiple reasons mainly related to the LISTENER/TNSNAMES configuration, but in my case it seems different and purely related to the ARGUMENTS/PARAMETERS passed to the External Function in the called DLL.

The reason why I am mentioning this is that when I am calling Funtions in the same DLL WITHOUT arguments, the function is processing normally without any Errors, Only when I am using PARAMTERS in my function call, I am getting the frustrating error ORA-28576.

The DLL functions with arguments expects POINTERS to be passed into these function and for that reason I tried using PARAMETERS BY REFERENCE but with no luck.

The more interesting part is that I was using the SAME External Procedure call on Another Machine (WIN2003 Server with Oracle 10g) and that was working perfectly well. When I tried the same code with Win2K server SP4 and Oracle 9.0.1.4.0 I am always getting the error. Besides, when I use the Sample External Procedure call provided by
http://docstore.mik.ua/orelly/oracle/langpkt/ch01_18.htm
on the Win2K server SP4 and Oracle 9i, it is working fine.

ATTACHED is my CODE and the DLL I am using.

THE FUNCTION I AM CALLING IN THE DLL HAS SUCH A STRUCTURE:
C format

int32 piut_connect( 

char PIPTR * procname );

Returns

>0
 System Error
 
0
 Success
 
-1
 Attempt to reconnect within 60 seconds or socket_open has failed
 
-994
 Incompatible PINET protocol version
 
-1001
 Default host not found
 

Arguments

procname (passed)

Character string identifying the client application to the server




How can I call this function or Adjust my parameters in PL/SQL to call this function.

Many thanks in Advance.
Re: Function Parameters throwing ORA-28576: lost RPC connection to external procedure agent (merged) [message #408754 is a reply to message #408746] Wed, 17 June 2009 11:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64111
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
RA-28576: lost RPC connection to external procedure agent
*Cause:  A fatal error occurred in either an RPC network connection,
         the extproc agent, or the invoked 3GL after communication had
         been established successfully.
*Action: First check the 3GL code you are invoking; the most likely
         cause of this error is abnormal termination of the
         invoked "C" routine. If this is not the case, check for
         network problems. Correct the problem if you find it. If all
         components appear to be normal but the problem persists, the
         problem could be an internal logic error in the RPC transfer
         code.  Contact your customer support representative.

Nothing is attached.

Regards
Michel

[Updated on: Wed, 17 June 2009 11:01]

Report message to a moderator

Re: Function Parameters throwing ORA-28576: lost RPC connection to external procedure agent (merged) [message #408848 is a reply to message #408746] Thu, 18 June 2009 01:07 Go to previous messageGo to next message
bbaz
Messages: 138
Registered: April 2007
Senior Member
Thanks Michel,

I came across this Cause and that's why I suspected the PARAMETERS passed to the DLL function are throwing this error.

I am reattaching the File.

Hopefully looking at the code can help Identify the cause.

Best regards

[Updated on: Thu, 18 June 2009 01:10]

Report message to a moderator

Re: Function Parameters throwing ORA-28576: lost RPC connection to external procedure agent (merged) [message #408849 is a reply to message #408746] Thu, 18 June 2009 01:13 Go to previous message
bbaz
Messages: 138
Registered: April 2007
Senior Member
I am trying to Upload the Code but it is not working so I am posting it below


CREATE OR REPLACE PACKAGE SUPPORT.pi_util
AS
 FUNCTION piut_connect (procname IN CHAR) RETURN PLS_INTEGER;
   PRAGMA RESTRICT_REFERENCES(piut_connect,WNDS,RNDS,WNPS,RNPS);
   
     --FUNCTION pipt_findpoint (tagname IN CHAR, pt OUT PLS_INTEGER) RETURN PLS_INTEGER;
   

--   FUNCTION piar_value (pt IN PLS_INTEGER, timedate IN PLS_INTEGER, rmode IN PLS_INTEGER, rval OUT FLOAT, istat OUT PLS_INTEGER ) RETURN PLS_INTEGER;
   

   FUNCTION piut_disconnect RETURN PLS_INTEGER;
  PRAGMA RESTRICT_REFERENCES(piut_disconnect,WNDS,RNDS,WNPS,RNPS);
   
   FUNCTION pitm_systime RETURN PLS_INTEGER;
   PRAGMA RESTRICT_REFERENCES(pitm_systime,WNDS,RNDS,WNPS,RNPS);
END pi_util;
/

CREATE OR REPLACE PACKAGE BODY SUPPORT.pi_util
AS
 
 FUNCTION piut_connect (procname IN CHAR)  RETURN PLS_INTEGER
   AS
      EXTERNAL
      LIBRARY piLIB
      NAME "piut_connect"
      PARAMETERS (procname BY REFERENCE)
      LANGUAGE C;       
     
   --   --PARAMETERS(procname BY REFERENCE);
      
   
 --  FUNCTION pipt_findpoint (tagname IN CHAR, pt  OUT  PLS_INTEGER)  RETURN PLS_INTEGER
   --AS
     -- EXTERNAL
     -- LIBRARY piLIB
     -- NAME "pipt_findpoint" 
     -- PARAMETERS(tagname,pt )
     -- LANGUAGE C;
    
    --  PARAMETERS(tagname BY REFERENCE,pt BY REFERENCE );
       
    
   
 --  FUNCTION piar_value (pt IN PLS_INTEGER, timedate IN PLS_INTEGER, rmode IN PLS_INTEGER, rval OUT FLOAT, istat OUT PLS_INTEGER ) RETURN PLS_INTEGER
   --AS
   
   --   EXTERNAL  
     -- LIBRARY piLIB
     ---- PARAMETERS(pt, timedate BY REFERENCE  , rmode , rval BY REFERENCE, istat BY REFERENCE),
     -- PARAMETERS(pt, timedate  , rmode , rval, istat)
      --NAME "piar_value"
      --LANGUAGE C;
   FUNCTION piut_disconnect RETURN PLS_INTEGER
   AS
      EXTERNAL
      LIBRARY piLIB
      NAME "piut_disconnect"
      LANGUAGE C;
   FUNCTION pitm_systime RETURN PLS_INTEGER
   AS 
      EXTERNAL
      LIBRARY piLIB
      NAME "pitm_systime"
      LANGUAGE C;    
END pi_util;
/

****************************************************************************

FUNCTION CREATED FOR CALLING THE EXTERNAL PROCEDURE

****************************************************************************

CREATE OR REPLACE FUNCTION "GETPIVALUE" (
server  CHAR ,
tag CHAR,
timedate DATE
)
RETURN FLOAT
IS
funRet PLS_INTEGER;
myDate PLS_INTEGER;
ret FLOAT;
point PLS_INTEGER;
istat PLS_INTEGER;
rmode PLS_INTEGER;
charDate CHAR(200);
can_not_connect_to_pi EXCEPTION;
tag_not_found EXCEPTION;
system_error EXCEPTION;
value_not_found EXCEPTION;
can_not_disconnect_from_pi EXCEPTION;
--server_name NVARCHAR2(6) := 'rwsrts';
date_rr pls_integer;
BEGIN
    ret := 0;
    rmode := 4;
   DBMS_OUTPUT.PUT_LINE('BEFORE CONNECTION server name: '|| server );
      funRet := PI_UTIL.PIUT_CONNECT(server);
   -- DBMS_OUTPUT.PUT_LINE('AFTER CONNECTION: '||funRet);
    --IF(funRet <> 0) THEN
      --  RAISE can_not_connect_to_pi;
    --END IF;
    --myDate := CREATEPIDATE(timedate);
    --funRet := PI_UTIL.PIPT_FINDPOINT(tag, point);
    --IF(funRet LIKE -5) THEN
      --  RAISE tag_not_found;
    --ELSIF(funRet <> 0 AND funRet <> -5) THEN
      --  RAISE system_error;
    --END IF;
    
    --funRet := PI_UTIL.PIAR_VALUE(point, myDate, rmode, ret, istat);
    --IF(funRet <> 0) THEN
      --  RAISE value_not_found;
    --END IF;
    date_rr:= PI_UTIL.pitm_systime();
    funRet := PI_UTIL.PIUT_DISCONNECT();
    IF(funRet <> 0) THEN
        RAISE can_not_disconnect_from_pi;
    END IF;
    
    RETURN(ret);
    EXCEPTION
        WHEN can_not_connect_to_pi THEN RAISE_APPLICATION_ERROR (-20001, 'Unable to connect to PI system');
        WHEN can_not_disconnect_from_pi THEN RAISE_APPLICATION_ERROR (-20002, 'Unable to disconnect from PI system');
        WHEN tag_not_found THEN RAISE_APPLICATION_ERROR (-20003, 'The supplied tag does not exist in the PI system.');
        WHEN value_not_found THEN RAISE_APPLICATION_ERROR(-20004, 'Unable to retrieve the value for a supplied tag.');
        WHEN system_error THEN RAISE_APPLICATION_ERROR(-20005, 'Error occured in the communication with the PI system.');
END;
/


Previous Topic: Invalid Datatype
Next Topic: Trigger to update table in other schema
Goto Forum:
  


Current Time: Mon Dec 05 23:48:45 CST 2016

Total time taken to generate the page: 0.13291 seconds