Problem in Calling External Procedure

Hello,
I am trying to call external procedure written in C from PL/SQL.
Here are the codes :
For external procedure:
#include<stdio.h>
void extproc_fn ( void )
FILE * file_handle;
if (( file_handle = fopen ( "/root/cprogs/extproc.out", "a" )) != NULL )
fwrite ( "External Procedure Testing", 26, 1, file_handle );
fclose ( file_handle );
I have created library as :
create or replace library extproc_lib as '/root/cprogs/extproc.so';
And the procedure :
create or replace procedure extproc_proc as
external
name "extproc_fn"
library extproc_lib
language c;
My listener and tnsname is configured correctly.
But when I try to connect to Oracle by that tnsname, extproc program core dumps under $ORACLE_HOME/network/log directory. Under WinNT, it creates a Dr. Watson error.
Any idea what might have gone wrong.
Thanks in advance.
Soumen Ghosh

hi there,
everything u did is correct as far as i recollect about external procedures ,the only thing that i suppose is missing is that u forgot to grant permissions on the library to the user...pls check this once i hope this works...
bye
Atul

Similar Messages

  • Problem of calling external procedures writen on C and use mysqlclient

    i have a problem at use to external library written on С++ and use mysqlclient under Oracle
    ORA-06521: PL/SQL: Error mapping function
    ORA-06522: /lib/libabrogation.so: undefined symbol: abrogation
    ORA-06512: at "WORK.ABROGATION", line 1
    ORA-06512: at line 9
    Start procedure:
    DECLARE
    PATH VARCHAR2(200);
    MESSAGE VARCHAR2(200);
    BEGIN
    PATH := '/tmp/test.ttt';
    MESSAGE := 'hhheh';
    WORK.ABROGATION ( PATH, MESSAGE );
    END;
    CREATE OR REPLACE LIBRARY WORK.LIBABROGATION
    IS '/lib/libabrogation.so'
    CREATE OR REPLACE PROCEDURE abrogation
    (path VARCHAR2
    ,message VARCHAR2) AS EXTERNAL
    LIBRARY libabrogation
    NAME "abrogation"
    PARAMETERS
    (path STRING
    ,message STRING);
    source of libabrogation.c
    #include <stdio.h>
    #include <my_global.h>
    #include <mysql.h>
    #include <errmsg.h>
    #include <mysqld_error.h>
    void abrogation(char path, char message)
    // Declare a FILE variable.
    FILE *file_name;
    // Open the File.
    file_name = fopen(path,"w");
    fprintf(file_name,"start0\n");
    MYSQL conn;
    if(!mysql_init(&conn))
    fprintf(stderr, "Error: can't create MySQL-descriptor\n");
    exit(1);
    if(!mysql_real_connect(&conn,
    "xxx.xxx.xxx.xxx",
    "xxx",
    "xxx",
    NULL,
    0,
    NULL,
    0))
    fprintf(file_name, "Error: %s\n", mysql_error(&conn));
    exit(1);
    if(mysql_query(&conn, "SET NAMES 'cp1251'") != 0)
    fprintf(file_name, "Error: can't set character set\n");
    exit(1);
    if(mysql_query(&conn, "USE `test`") != 0)
    fprintf(file_name, "Error: %s\n", mysql_error(&conn));
    exit(1);
    if(mysql_query(&conn,
    "INSERT INTO orains VALUES (NULL,12)") != 0)
    fprintf(file_name, "Error: can't execute INSERT-query\n");
    exit(1);
    fprintf(file_name,"%d\n",mysql_insert_id(&conn));
    mysql_close(&conn);
    // Close the file.
    fclose(file_name);
    compile:
    gcc -fPIC -c -I/usr/include/mysql libabrogation.c
    gcc -fPIC -shared libabrogation.o /usr/lib/mysql/libmysqlclient.a /usr/lib/libz.a -lssl -Wl,-h,libabrogation.so -o libabrogation.so
    library is corrected and testing:
    source main.cpp
    #include <stdio.h>
    #include <dlfcn.h>
    #include <stdlib.h>
    #include "libabrogation.h"
    int main(int argc, char **argv)
    void *lib_handle;
    double (*fn)(char path, char message);
    char *path="/tmp/test.ttt";
    char *message="hhheh";
    char *error;
    lib_handle = dlopen("/lib/libabrogation.so", RTLD_LAZY);
    if (!lib_handle)
    fprintf(stderr, "%s\n", dlerror());
    exit(1);
    fn = dlsym(lib_handle, "abrogation");
    if ((error = dlerror()) != NULL)
    fprintf(stderr, "%s\n", error);
    exit(1);
    (*fn)(path,message);
    dlclose(lib_handle);
    return 0;
    compile: gcc -rdynamic main.c -o main -ldl
    if change code of abrogation.cpp and compile, all successfully work under Oracle:
    #include <stdio.h>
    void abrogation(char path, char message)
    // Declare a FILE variable.
    FILE *file_name;
    // Open the File.
    file_name = fopen(path,"w");
    fprintf(file_name,"start0\n");
    // Close the file.
    fclose(file_name);
    what's the problem?

    You can create the Object/types in Oracle and use OTT utility to create persistency related code.
    How ever I recommend to use similar table rather than using Objects . Since objects are costly in RDBMS.

  • HELP!!! Problem of Calling external Web Service from a Java Stored Procedur

    1.I read the topic on http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/wsclient/Readme.html about Calling external Web Service from a Java Stored Procedur.
    2.After I import .jar to Oracle what is required by the topic,som error occued.
    Like: ORA-29521: javax/activation/ActivationDataFlavor class not found,
    ORA-29545: badly formed class.
    3.These is not enough .jar required on the topic? What can I do for ORA-29545: badly formed class?
    Thany you!

    Try this
    Re: HELP! Loading Java Classes into Oracle ERROR

  • Error calling external procedure on remote server

    Hello
    I have written an external procedure that runs correctly when it is on the same machine as the database from which I call it. (Windows XP Professional/Oracle 9.2)
    When I try to call the procedure from a database on another machine (also Windows XP Professiona l/ Oracle 9.2) I get ORA - 28756 "lost RPC connection to external procedure agent" or ORA - 28758 "protocol error during callback from an external procedure". Using filemon I can see that the DLL is never searched for or called. The problem seems to lie in the communication between the two machines. When I observe network traffic the machines communicate on port 1521 (the listener) and then switch to the port that the listener returns. Shortly after that the connection is terminated with the above error reported in the PL/SQL routine.
    The Oracle Administrator's Guide (9.2) states that "the agent must reside on the same computer as the application making the external procedure call." However there are several entries on the internet that show how to do what I am want to accomplish - I suspect I am making some small mistake.
    Any help would be greatly appreciated!
    Here is the listener on the machine with the DLL.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = jacxp01)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\oracle\ora90)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=C:\easydist\easydist\Debug\easydist.dll;C:\easydist\easydist\Release\easydist.dll")
    Here is the TNSnames.ora on the remote database machine: (I have also tried the commented lines with no more success)
    # TNSNAMES.ORA Network Configuration File: C:\oracle\ora92\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(Key = EXTPROC1))
    #(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.121)(PORT = 1521))
    (CONNECT_DATA =
    #(SERVICE_NAME = PLSExtProc)
    (SID = PLSExtProc)
    )

    Hi Long Le Hoang,
    I am running a shell script fromSM69 which call psexec.
    shell script runs fine but SM69 execution goes on hold.
    Can you please help me how to terminate SM69 execution.
    Alpa

  • Db Adapter: problems by calling a procedure with type as parameter

    Hi,
    We using a db adapter in a bpel process.
    In that dapter we call a procedure with types as in and out parameter
    package.procedure(p_in IN in_t, p_rsult OUT result_t).
    When we calling the procedure, we don't call the procedure directly.
    We call that procedure in a schema who have the execute rigths for the package and the types.
    When we run the process we get the error message
    unable to convert the xsd element p_in whose user defined type is in_t
    cause: java.sql.SQLException: ora-01436 connect by loop in user data
    I am not shore if I draw the right conclusions.
    Is it rigth that bpel have a problem by using types as parameter when using two schematas? Isn't it a bug.
    For every help I was thankful.
    Thanks in advanced.
    Michael

    Hi,
    thanks for the hint. I have implemented a wrapper package and it's working well.
    Only one crux. The parameter of the called procedure are data types and not simple types.
    CREATE OR REPLACE TYPE pesa_db_return_t AS OBJECT
    (SUCCESS_MSG varchar2(255)
    ,FAULT_SQLCODE varchar2(255)
    ,FAULT_SQLMSG varchar2(255)
    Wrapper package...
    IS
    PROCEDURE prc_writeReOinDB (p_AuftragRechnungOnline IN pesa_data.pesa_tivu_reo_t
    ,p_result OUT pesa_data.pesa_db_return_t)
    IS
    BEGIN
    pkg_pesa_reo.prc_writeReOinDB (p_AuftragRechnungOnline => p_AuftragRechnungOnline
    ,p_result => p_result
    END prc_writeReOinDB;
    END pkg_pesa_wrapper;
    So I have to declare the parameter with the schema user in front of.
    Now, we have deployed thes sources on a second enviroment and get following error:
    <2008-04-22 15:01:25,749> <ERROR> <eweber.collaxa.cube.engine.dispatch> <BaseScheduledWorker::process> Failed to handle dispatch message ... exception ORABPEL-05002
    Message handle error.
    An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.instance.CallbackDeliveryMessage"; the exception is: Type class not found.
    Cannot find class for type "org.apache.xerces.dom.ElementNSImpl". Please check that the class is located in the classpath.
    You have a hint for me what I have to do?
    Thanks in advanced,
    Michael

  • Problem to call a procedure in Oracle

    Hi,
    I create a simple Oracle procedure like following
    CREATE OR REPLACE PROCEDURE util_session_insertion (in_user_id IN NUMBER, in_note IN VARCHAR2, v_next_id OUT NUMBER)
    IS
    BEGIN
    -- get next id
    SELECT session_id_seq.nextval INTO v_next_id FROM dual;
    -- insert into session table
    INSERT INTO sessions (session_id, user_id, notes, source_agency_id) VALUES (v_next_id, in_user_id, in_note);
    commit;
    EXCEPTION WHEN OTHERS THEN
    rollback;
    END;
    and I try to call the procedure as follows
    cstmt = conn.prepareCall("{call util_session_insertion(?, ?, ?)}");
    cstmt.setInt(1, Integer.parseInt(request.getParameter("user_id")));
    cstmt.setString(2, request.getParameter("notes"));
    cstmt.registerOutParameter(3, java.sql.Types.INTEGER);
    cstmt.execute();
    v_session_id = cstmt.getInt(1);
    The record is inserted, but I always get the error message
    java.sql.SQLException: Invalid column index
    How to I fix this problem?
    Thanks,
    Grace

    cstmt.registerOutParameter( 3, java.sql.Types.INTEGER);
    cstmt.execute();
    v_session_id = cstmt.getInt( 1,);
    The record is inserted, but I always get the error
    message
    java.sql.SQLException: Invalid column index
    How to I fix this problem?The error message tells you exactly what is wrong.

  • Having problem with calling external javascript functions in LV

    Hi,
    I found this VI: http://lavag.org/topic/10304-discuss-calling-external-javascript/, which I believe can be really helpful for my work. The problem is I can't get it to run based on the following problem:
     - Apparently the "ScriptControl" cannot be loaded
    I am using LabView 8.6, and this vi has been produced in a 8.0 version. Do you think this is the problem? If not, what could cause this problem running this VI?
    Thanks,
    Diogo

    Hi,
    To start I am using this examplo from the google code page.
    <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps JavaScript API Example</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
                type="text/javascript"></script>
        <script type="text/javascript">
        function initialize() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(37.4419, -122.1419), 13);
            map.setUIToDefault();
        </script>
      </head>
      <body onload="initialize()" onunload="GUnload()">
        <div id="map_canvas" style="width: 500px; height: 300px"></div>
      </body>
    </html>  
    It loads a basic map, and is saved in a html file created for example in Notepad. Basically as I said the VI is very simple, see next image.
    But like I said, this strategy does not allow labview to interface dinamically with the javasscript code in the html file. Doing it this way, I would have to constantly update the code in the file with new coordinates and loading the map again. This causes the mentioned flickering problem that I also had with static maps.
    Diogo

  • Problem with Oracle external procedures and Microsoft Active Directory

    Hi,
    Our server was recently updated to use Microsoft Active Directory. However, we noticed that all external procedure calls keeps on failing with ORA-28575: unable to open RPC connection external procedure agent. Everything was working fine before we migrated to Active Directory which is why we can say that the listener is configured correctly.
    Any idea on how we can make extproc calls with Active Directory?
    thanks.

    Michael,
    Oracle Forms does support Single Sign-On (SSO). Take a look at Oracle Containers for J2EE Security Guide: OC4J Java Single Sing-On. Also take a look at the Oracle Forms 10g Sample Code and scroll to the SSO demo under the Forms Services Demo section. There are also, numerous other documents available via Google. ;-)
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Problem in calling oracle procedure from java

    Oracle procedure with the following parameters.
    CREATE OR REPLACE PROCEDURE CREDITED_TO_STORE_INSERT (P_CUST# IN NUMBER,
    P_INV_DATE IN DATE,
    P_MEMO# IN NUMBER,
    P_SESS_ID IN VARCHAR2 ) IS
    BEGIN
    /*.........Procedure Body with select and insert statements there no OUT or return variable/value......*/
    END;
    Now i am calling this procedure with the java code in java.
    public boolean execProcedure(String storeNo, String invoiceDate, String claimNo, String sessionID) throws SQLException {
         CallableStatement cstmt = null;
         java.sql.Date invicDate = this.StringToDate(invoiceDate);
         try
         cstmt = conn.prepareCall("{call WEBUSER.CREDITED_TO_STORE_INSERT(?,?,?,?,?,?)}");
         cstmt.setInt(1, Integer.parseInt(storeNo));
         cstmt.setDate(2, invicDate);
         cstmt.setInt(3, Integer.parseInt(claimNo));
         cstmt.setString(4, sessionID);
         cstmt.execute();
         catch (Exception e)
         System.out.println (e);
         } // catch (Exception e)
         finally
         try
         cstmt.close();
         catch (Exception ex)
         } // catch (Exception ex)
         } // finally
         return true;
    But it will return the following exception.
    [STDOUT] java.sql.SQLException: Missing IN or OUT parameter at index:: 5
    i don't know why :( please help me ...

    your procedure has 4 parameters but in the prepared statement you define 6 placeholders

  • Problem to call stored procedure with several IN pars and single REF Cursor

    Hi,
    Oracle 9.2.0.1
    Ole DB Provider I've got with ODP 9.2.0.4
    First I try to call packaged procedure with single
    REF CURSOR - it works fine(PROCEDURE getDep(dep OUT DEPART.refcur) IS ...).
    When I try to call procedure with additional IN parameter, I get an error ORA-01008: not all variables bound.
    Packaged procedure: PROCEDURE getDep(dep OUT DEPART.refcur, i1 IN number) IS .... and so on.
    Try to call from C#:
    cmd.CommandText = "{call depart.getDep(?)}";
    OleDbParameter par0 = cmd.CreateParameter();
    par0.Value = some value;
    par0.DbType = DbType.Int16;
    par0.OleDbType = OleDbType.Integer;
    par0.Direction = ParameterDirection.Input;
    OleDbDataAdapter da = new OleDbDataAdapter(cmd.CommandText,con);
    DataSet ds = new DataSet();
    da.Fill(ds);
    Connection string:
    "Provider=OraOLEDB.Oracle;User Id=scott;Password=tiger;Data Source=ora92;OLEDB.NET=true;PLSQLRSet=true"
    Please, HELP !
    Thanks in advance,
    Vyacheslav

    Hi,
    Are you using OLEDB.NET driver (System.Data.Oledb) or ODP.NET driver (Oracle.DataAccess)?
    If you are using ODP.NET, remember that you need to bind the refcursor output variable also (besides the numbder)
    Arnold

  • Package: Difference between calling external procedures vs. internal

    I have a package which has a bunch of procedures. I have decided to move one of the procedures outside the package because there is a user that needs control over the SQL in it. I pass 2 dates into it so I don't think I can create a view. My question is this:
    What is the difference in syntax to call a procedure outside the package as opposed to one inside the package?

    I don't think I've ever been in the position of having a stand-alone procedure with the same name as a packaged procedure and needing to call the stand-alone one from within the package, but it is still possible:
    SQL> CREATE PROCEDURE p
      2  AS
      3  BEGIN
      4      DBMS_OUTPUT.PUT_LINE('This is the stand-alone procedure');
      5  END;
      6  /
    Procedure created.
    SQL> CREATE PACKAGE pkg
      2  AS
      3      PROCEDURE testit;
      4  END;
      5  /
    Package created.
    SQL> CREATE PACKAGE BODY pkg
      2  AS
      3      PROCEDURE p
      4      IS
      5      BEGIN
      6          DBMS_OUTPUT.PUT_LINE('This is a procedure in package PKG');
      7      END;
      8 
      9      PROCEDURE testit  
    10      IS
    11      BEGIN
    12          william.p;
    13      END;
    14  END;
    15  /
    Package body created.
    SQL> exec pkg.testit;
    This is the stand-alone procedure
    PL/SQL procedure successfully completed.
    SQL>

  • Problem in calling a procedure in form builder

    sir
    i have developed a procedure in pl\sql libriries but when i call this procedure from trigger compiler can not recognized this procedure.
    procedure is: computetotal
    libraries name is pl_004
    plese help me and give me solution
    thanks in advance

    It the library is attached, expand the attached library, and try dragging the program unit in question, to local program units of the form and then try to compile the form.
    The only cause could be that library is not attached to the form, so give this above method a try to cross-check.

  • Problem to call a procedure while using External connection pooling in TopL

    HI all,
    I have implemented external connection pooling in TopLink with JBoss 4.0.3SP1 and it is working fine. But after the connection pooling I am getting error while executing stored procedure with TopLink on Sybase. This is the error I am getting......
    Stored procedure 'P_InsReleaseToManufact' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.
    I got one solution to this problem as to set a tag in sybase-ds.xml file(which is used in JBoss to enable connection pooling) ..............
    <connection-property name="SQLINITSTRING">set chained off</connection-property>
    but still it is not working.
    Can some one please tell me about the solution.

    Try
    session.getLogin().handleTransactionsManuallyForSybaseJConnect();

  • Problem when calling external program

    Hi,
    I have a strange problem and no more idea how to solve it.
    What I do:
    In Java I call an external Fortran-exe with Runtime.getRuntime().exec(...) This Fortran program creates 4 files.
    What I get:
    One of the 4 files is incomplete, the first few lines are missing.
    What makes me wonder:
    When I take the exec-statement to the commandline and let it run there, everything is fine and the files contain all the info I need. All the 4 files are correct then.
    What I also tried:
    I tried to copy the (incomplete) file within Fortran. That means when I call the Fortran program I get 2 identical files then but with different filenames. Doing so on the commandline everything is fine again. But again, the same commandline String called in the exec in my Java program it is getting worse: The formerly incomplete file is empty now with 0 bytes.
    Even if I wait for the process to finish does not help.
    I do not understand it any more and would really like to know what happens there, why, and what can I do to avoid it or to get my complete output files. What does Runtime.getRuntime().exec(myString) do different than when I take the myString on the commandline?
    Any hints welcome.
    TIA

    Hi,
    unfortunately this does not help. I have already about 15 Fortran programs running this way which work accurately. So a possible problem with output stream does not look reasonable to me in this case.

  • Problem when call store procedure over a database link

    Hi all,
    I've create a database link in server "EAST" similar like:
    CREATE DATABASE LINK db_link CONNECT TO tiger IDENTIFIED BY scott USING 'abc';
    and from server "EAST" i ran the procedure located in server "WEST" somethin like:
    exec testing_procedure@db_link('test');
    testing_procedure is look like:
    Create or Replace procedure testing_procedure (p_testing in varchar2)
    as
    cursor check_space is
    select sum(bytes)/1024/1204 tb_size
    from dba_data_files;
    my_check_space%ROWTYPE;
    begin
    open check_space;
    loop
    fetch check_space into my_check_space;
    exit when check_space%NOTFOUND;
    insert into test_tf@db_link (test, tb_value) values
    (p_testing, my_check_space.tb_size);
    end loop;;
    close check_space;
    end;
    and my problem is when i'm run procedure from "EAST" server, the values in test_tf table is the same as when you run that procedure from "WEST" server. I've check the size for both server "EAST", and "WEST" by select sum(bytes)/1024/1204 command. And the value is completely different. And i guest somehow it reuse the value of "WEST" server no matter when you run that procedure in "EAST" server. Any suggesttion, please give me some advices.
    Thanks,
    Kevin

    If this procedure is in WEST server then even if you call it from some another planet using db link, the cursor inside the procedure will fetch the data from that server only means WEST server. So "select sum(bytes)/1024/1204 tb_size
    from dba_data_files;" statement in your procedure always fetch the size of the datafiles belongs to the WEST database.
    If you want to store the data of two different databases then you have to create the similar procedure in EAST database also.
    BTW, you said the you created a database link "db_link" in EAST database to point to WEST database and on WEST database you have that procedure BUT I don't understand why r u using "db_link" in your procdure code in WEST server in this insert statement:
    insert into test_tf@db_link (test, tb_value) values
    (p_testing, my_check_space.tb_size);Is there a database link on that box also?? Where it is pointing to?? And if not then this code should not be compiled.
    Daljit Singh

Maybe you are looking for

  • USB Drive Connected to Airport Extreme:  I can see, but can't access

    Connected one printer and two USB hard drives through USB hub to Extreme. Printer works ok. Both Drives are visible in Finder, but won't show files. Tried to copy files through Finder to each USB drive and got an "Error Code 8058". Tested each drive

  • How can I get my money back from apps I purchased that don't work

    Dear Apple      I recently purchased two apps from your store one was 3.99 and one was 9.99 however they do not work I would like to know what steps I need to take to get my money back.

  • Read content of a Z Class Element

    Hello, I have ZCL_WF_MATMAS CL it is contain MATMAS element. I want to read data of this element. But I couldn't find correct FM. I also tryed SWW_WI_CONTAINER_READ_OBJECTS, SAP_WAPI_READ_CONTAINER etc. But I couldn't find correct FM for this... How

  • PX Deq: Execute Reply  - Wait event

    I am seeing PX Deq: Execute Reply wait event for a query which returns no data. From metalink I see this can be ignored. Any suggestion is appreciated.

  • Compiling in linux

    Sorry i am new to working on java with linux. i got a LoadDriver class n Test class... i got no problem compiling LoadDriver class.. but when i compile Test class.. i encountere class file of LoadDriver not found... Both file are in the same director