Can't publish java xml stored procedure

I have written a java class to return values from the database as XML using the XSU, and am attempting to publish the class as a stored procedure. I have successfully created other java stored procedures, but am continually getting the following error on this one:
ORA-29531: no method getItems in class foo/bar/Inbox
To illustrate the interface which I am trying to implement, snippets from the java class and the Oracle package follow:
===========================================
Java class:
package foo.bar;
import oracle.sql.CLOB;
import other.stuff;
public class Inbox {
public static void getItems(int userID,
CLOB[] xml)
===========================================
Oracle package spec:
PROCEDURE getItems(user_id IN PLS_INTEGER,
buf IN OUT NOCOPY CLOB);
Package body:
PROCEDURE getItems(user_id IN PLS_INTEGER,
buf IN OUT NOCOPY CLOB)
AS LANGUAGE JAVA NAME
'foo.bar.Inbox.getItems(java.lang.Integer,
oracle.sql.CLOB[])';
===========================================
I originally structured the class to return the CLOB, but altered the structure to handle the CLOB as an IN OUT parameter so that the NOCOPY option modifier could be used, as suggested in S. Muench's book. I was surprised to hear that Oracle creates an in-memory copy of the return value from a function (wish I'd known this before).
All suggestions appreciated.
null

When I use JDeveloper's automatic Java Stored Procedure publishing feature, I get a PL/SQL spec that looks like this:
CREATE OR REPLACE PACKAGE EXPERIMENTALWORK
AUTHID CURRENT_USER AS
PROCEDURE GETITEMS ("userID" IN NUMBER,
"xml" IN OUT CLOB)
AS LANGUAGE JAVA
NAME 'foo.bar.Inbox.getItems(int, oracle.sql.CLOB[])';
END EXPERIMENTALWORK;You still have to add the NOCOPY by hand, but perhaps the int versus java.lang.Integer is significant?

Similar Messages

  • Help Needed in Xml Stored Procedure

    Hi , i am trying to write one sp which takes xml document as a parameter. I want to update/Insert the data in the xml based on some conditions. So i put the data from xml to a global TEMPORARY table. The i process this data and will update /Insert the data based on the output.
    Right now i am unable to create global TEMPORARY table my stored procedure .When i compile the stored procedure , its showing the following error
    Compilation errors for PROCEDURE SYSTEM.TESTXML
    Error: PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe
    Line: 8
    Text: CREATE GLOBAL TEMPORARY TABLE temp
    I am attaching my sp below
    create or replace procedure testxml
    ( xmlDoc IN clob )
    is
    updCtx DBMS_XMLStore.ctxType;
    rows NUMBER;
    begin
    CREATE GLOBAL TEMPORARY TABLE temp
    ( cdcalendar NUMBER,
    cdperiod NUMBER,
    cdsubperiod NUMBER,
    cdglperiod NUMBER,
    dtstartsubperiod date,
    dtendsubperiod date
    ) ON COMMIT PRESERVE ROWS;
    updCtx := DBMS_XMLStore.newContext(temp)
    rows := DBMS_XMLStore.insertXML(updCtx,xmlDoc);
    DBMS_XMLStore.closeContext(updCtx);
    if Not exists
    (Select Distinct cd_calendar from Calendar_Period
    Where cd_calendar = select Distinct cdcalendar from temp )
    Then
    Insert into calendar_period
    cd_calendar,
    cd_period,
    cd_subperiod,
    cd_gl_period,
    dt_start_subperiod,
    dt_end_subperiod
    select cdcalendar,
    cdperiod,
    cdsubperiod,
    cdglperiod,
    dtstartsubperiod,
    dtendsubperiod
    from temp ;
    Else
    Update calendar_period
    Set cdp.cd_calendar = temp.cdcalendar ,
    cdp.cd_period = temp.cdperiod,
    cdp.cd_subperiod = temp.cdsubperiod ,
    cdp.cd_gl_period = temp.cdglperiod,
    cdp.dt_start_subperiod = temp.dtstartsubperiod ,
    cdp.dt_end_subperiod = temp.dtendsubperiod
    From
    calendar_period cdp Inner Join temp
    On
    cdp.cd_calendar = temp.cdcalendar
    cdp.cd_subperiod = temp.cdsubperiod
    cdp.cd_period = temp.cdperiod ;
    End if
    end testxml;
    Kindly guide me !!!!

    Hi,
    "CREATE GLOBAL TEMPORARY TABLE" is not a PL/SQL sommand; it is a SQL command. That explain the error message you're getting.
    Normally, tables (including Global Temporary Tables) are created once for all, without using PL/SQL. After they are created, you can write PL/SQL code to populate and use them. This job doies not seem to be an exception.
    In the rare event that you do need to create a table in PL/SQL, use EXECUTE IMMEDIATE, which can do any SQL command from withiin PL/SQL.
    EXECUTE IMMEDIATE is documented in the PL/SQL manual:
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28370/dynamic.htm#sthref857

  • Java call stored procedure with nested table type parameter?

    Hi experts!
    I need to call stored procedure that contains nested table type parameter, but I don't know how to handle it.
    The following is my pl/sql code:
    create or replace package test_package as
    type row_abc is record(
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    type matrix_abc is table of row_abc index by binary_integer;
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    END test_package;
    create or replace package body test_package as
    PROCEDURE test_matrix(p_arg1 IN VARCHAR2,
    p_arg2 IN VARCHAR2,
    p_arg3 IN VARCHAR2,
    p_out OUT matrix_abc
    IS
    v_sn NUMBER(8):=0 ;
    BEGIN
    LOOP
    EXIT WHEN v_sn>5 ;
    v_sn := v_sn + 1;
    p_out(v_sn).col1 := 'col1_'||to_char(v_sn)|| p_arg1 ;
    p_out(v_sn).col2 := 'col2_'||to_char(v_sn)||p_arg2 ;
    p_out(v_sn).col3 := 'col3_'||to_char(v_sn)||p_arg3 ;
    END LOOP ;
    END ;
    END test_package ;
    My java code is following, it doesn't work:
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    Connection con = DriverManager.getConnection
    ("jdbc:oracle:thin:@10.16.102.176:1540:dev", "scott", "tiger");
    con.setAutoCommit(false);
    CallableStatement ps = null;
    String sql = " begin test_package.test_matrix( ?, ? , ? , ? ); end ; ";
    ps = con.prepareCall(sql);
    ps.setString(1,"p1");
    ps.setString(2,"p2");
    ps.setString(3,"p3");
    ps.registerOutParameter(4,OracleTypes.CURSOR);
    ps.execute();
    ResultSet rset = (ResultSet) ps.getObject(1);
    error message :
    PLS-00306: wrong number or types of arguments in call to 'TEST_MATRIX'
    ORA-06550: line 1, column 8:
    PL/SQL: Statement ignored
    Regards
    Louis

    Louis,
    If I'm not mistaken, record types are not allowed. However, you can use object types instead. However, they must be database types. In other words, something like:
    create or replace type ROW_ABC as object (
    col1 varchar2(16),
    col2 varchar2(16),
    col3 varchar2(16 )
    create or replace type MATRIX_ABC as table of ROW_ABC
    /Then you can use the "ARRAY" and "STRUCT" (SQL) types in your java code. If I remember correctly, I recently answered a similar question either in this forum, or at JavaRanch -- but I'm too lazy to look for it now. Do a search for the terms "ARRAY" and "STRUCT".
    For your information, there are also code samples of how to do this on the OTN Web site.
    Good Luck,
    Avi.

  • Can I stop (Kill) an Stored Procedure?

    Hi All,
    I have several Stored Procedures to extract data from a database to anothe database the SP's takes approximately 3 hours, they are calls from java.
    Can I stop the SP from java code and rollback all the actions from him????

    I dont know how you will kill from JAVA, because you may need to identfy the ORACLE session and run a new JAVA program and kill it. IF you can connect through ORACLE then you can tr this (provided you have the previlages)
    Get the session id by using the following SQL.
    SELECT sid, serial#,osuser, program FROM v$session;
    Use this to kill the session.
    ALTER SYSTEM KILL SESSION 'sid,serial#';
    Thanks

  • How can I push a Oracle Stored Procedure to execute a HOST OS shell?

    I am trying to push a request to execute a script on the OS (Unix). I've seen some examples using Java, but I want this to be Java-independent, if possible.
    From the SQL*PLUS command line I can issue a HOST statement (Example: HOST ls -l /home/userid sends the ls -l command to the OS). I don't believe this is supported directly via the JDBC. From a security standpoint, I am fine with that. I would like to be able to create a stored procedure that would execute a specific shell script.
    I am not sure how this could be done, easily.

    I've seen some examples using Java, but I want this to be Java-independent,A novel and admirable sentiment, but why?
    Some standard supplied PL/SQL packages use Java for certain things that it is actually useful for and this is one of them.
    The standard approach uses Java, but once you have compiled those 42 lines of code you can forget they were written in Java if you like.
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:952229840241

  • Can't see my Oracle stored procedure in the avalable data source list

    Post Author: Moori
    CA Forum: Data Connectivity and SQL
    Hello All,
    I've created an Oracle stored procedure which I need to use it's returned data in my crystal report but I can't find it in the data source list.
    I'm using the same schema & database and user as my sp was created on.
    Please advise.
    Moori

    Jim (also Geoff and Hal)-
    Still haven't solved this. Here's another try at a screenshot, showing just below this text for me, of my Library interface showing the C drive listed in the left panel and not showing the C drive contents. Only, as you said is intended, what is already in Lightroom.
    I thought if I was not in "Catalog" I had been able, in the past, to select from anything in my C crive simply by opening that folder in the panel.
    When I click import it is usually - from memory - to start the import of the already selected items. For a time that's what was happening from the above screen if I selected Import. It would apparently start re-importing the selected items and without presenting the usual familiar dialog asking about file naming, etc. Now, however, clicking Import bring up this:
    Never saw this black horizontal dialog box before this situation arose. I was able to import but not as usual and I would like to get back the square (moreso at least) "white" dialog box. No clue what's going on or how to get bact to familiar ground. Ideas?

  • HELP: Can't Pass Parameters w/Stored Procedure as Data Connection

    I'm working on using an existing employment application in PDF format, and I want the form fields to be prepopulated with the user's specific data.
    I'd like is so that when a user clicks a link (like www.mysite.com/empapp/empapp.pdf?UserID=5), a dynamic PDF document will open up and that user's data will be populated inside of the form fields by using that user's "UserID" variable/parameter that was passed in the querystring.
    I've tried a stored procedure that contains the following select statement:
    SELECT * FROM tblEmpApp WHERE UserID = @UserID
    I've also tried entering this select statement manually into the box instead of using a stored procedure without success. When I try to use the stored procedure, I receive this error:
    Stored procedure "spEmpApp" has non-optional parameters.
    How can I set the PDF doc up to populate the form fields based on that passed parameter in the querystring???
    ******************PLEASE HELP!!!******************

    had this same issue.  following works for me.
    -create a dataconnection to the db with a random query to the table.
    -just clone the dataconnection
         oDConn = xfa.sourceSet.DataConnection.clone(1);
    -change the query attribute to the stored procedure
         oDConn.resolveNode("#command").query.select.value = "exec spEmpApp 'parameter'"
    -open the cloned data connection
         oDconn.open();

  • XML - Stored Procedure

    Hi ,
    How to parse the xml to Stored procedure?
    Regards
    Thamilselvan J

    How to parse the xml using Stored procedure?Please find the sample code below.(invoke a webservice,get the soap response XML and subsequently parse the XML)
    DECLARE
    http_req utl_http.req;
    http_resp utl_http.resp;
    ls_out_resp varchar2(32767);
    ls_out_xml xmltype;
    ls_out varchar2(200);
    BEGIN
    -- Invoke the webservice\URL
    http_req := utl_http.begin_request("your webservice url", 'GET' ,'HTTP/1.1');
    -- Set the Content header
    utl_http.set_header(http_req,'Content-Type','text/xml;charset=UTF-8');
    -- Get the HTTP response
    http_resp := utl_http.get_response(http_req);utl_http.read_text(http_resp, ls_out_resp);
    - - Parse the XML response
    ls_out_xml := xmltype(ls_out_resp);
    ls_out:=ls_out_xml.extract('/GDSXYZ/RESULT/ZZZ/text()').getStringVal();
    utl_http.end_response(http_resp);
    The lines in bold are the ones to parse the XML.
    Good luck!!!
    Bhagat

  • Can sqltaglib.tld execute Oracle stored procedure?

    Is it possible to execute Oracle stored procedure through Oralce's own sqltaglib.tld. The sqltaglib on-line manual only shows how to run SQL query/insert/update statement.
    Thanks,

    I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
    THE SOLUTION
    cs = con.prepareCall("{ call get_countries(?) }");
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);

  • JCABindingException when running published PL/SQL stored procedure on OSB

    Hi,
    JDEV 10.1.3.4
    OSB 10.3.1
    I have published a simple PL/SQL function on OSB.
    FUNCTION pubProc(pinput XMLTYPE) RETURN XMLTYPE.
    I used DBAdapter wsdls,jca created by JDEV 10.1.3.4.
    When I test business service with message:
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    </soap:Header>
    <soapenv:Body>
    <pub:InputParameters xmlns:pub="http://xmlns.oracle.com/pcbpel/adapter/db/OSWD/TESTDBPUBLISH/PUBPROC/">
    <!--Optional:-->
    <pub:PINPUT>
    <a>bcd</a>
    </pub:PINPUT>
    </pub:InputParameters>
    </soapenv:Body>
    </soapenv:Envelope>
    I got:
    <JCA_TRANSPORT_RUNTIME_APPLICATION_FAULT xmlns="http://www.bea.com/transport/2007/05/jca">
    oracle.tip.adapter.sa.api.JCABindingException: oracle.tip.adapter.sa.impl.fw.ext.org.collaxa.thirdparty.apache.wsif.WSIFException: servicebus:/WSDL/DEV/WSDL/testdbpublish [ testdbpublish_ptt::testdbpublish(InputParameters,OutputParameters) ] - WSIF JCA Execute of operation 'testdbpublish' failed due to: Error while converting to a Java object.
    Unable to convert the XSD element PINPUT whose SQL type is Opaque and JDBC type is OPAQUE. Cause: java.lang.ClassCastException: weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_weblogic_jdbcx_base_BaseConnectionWrapper.
    ; nested exception is:
    JCA-11803
    Error while converting to a Java object.
    Unable to convert the XSD element PINPUT whose SQL type is Opaque and JDBC type is OPAQUE. Cause: java.lang.ClassCastException: weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_weblogic_jdbcx_base_BaseConnectionWrapper.
    Check to ensure that the XML data describing the object matches the definition of the element in the XSD. Contact oracle support if error is not fixable.
    Could someone please tell what is wrong ?
    Shoud I perform any custom transformation ?
    Regards,
    Cezary

    Hi Cezary,
    OSB has told you what has gone wrong -
    Unable to convert the XSD element PINPUT whose SQL type is Opaque and JDBC type is OPAQUE. Cause: java.lang.ClassCastExceptionTry with below input -
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    </soap:Header>
    <soapenv:Body>
    <pub:InputParameters xmlns:pub="http://xmlns.oracle.com/pcbpel/adapter/db/OSWD/TESTDBPUBLISH/PUBPROC/">
    <!--Optional:-->
    <pub:PINPUT>
    <bcd/>
    </pub:PINPUT>
    </pub:InputParameters>
    </soapenv:Body>
    </soapenv:Envelope>
    Regards,
    Anuj

  • Java in Stored Procedures

    Hi all,
    This is the Problem i am facing. Can anyone help please !!!!
    I hv creaeted a java source file to print "Hello World" and compiled to create java class file. Now i hv both the .java and .class file under the directory c:\suresh\javaexam.
    I tried loading the java file to the database using loadjava utility. I hv not done any modifications to the classpath or anything. I had jdk installed prior to Oracle installation in my machine.
    The loadjava utility generates the following error message
    unable to initialize threads : cannot find class java/class/thread. Could not create Java VM.
    Here is the command i tried.
    loadjava -u scott/tiger -resolve c:\suresh\javaexam\Dba.java.
    Then i included all the jar files in jdk directory in the jreclasspath of loadjava.bat and tried the command again. Even then it is giving the same problem.
    Can anyone please help me to overcome this ?
    Problem 2.
    I used Create Java command to load java in RDBMS. But when checked with user_objects, the status says Invalid. --- Why is this shows Invalid ? How to make it Valid ?
    Advance Thanks for the Reply.
    my e-mail id : [email protected]
    Regards
    PB Suresh

    What is the Java version you are using. Is it 1.1.X or 1.2.X?
    The loadjava command is a batch file on nt.
    Set the CLASSPATH from the command line to the following.
    set CLASSPATH=c:\jdk1.1.8\lib\classes.zip;c:\orant\jdbc\lib\classes111.zip;.
    Now run the loadjava.
    null

  • PL/SQL vs. Java stored procedures.

    After learning about PL/SQL I have to admit it looks ugly to me. Is there any concrete reasons why PL/SQL should be used over Java for stored procedures. I understand that PL/SQL is native to Oracle and procedures written in PL/SQL would probably out perform Java procedures, but what if performance was not the most critical issue. Looking at PL/SQL makes me think it would be hard to maintain.
    Thanks in advance.

    Hi
    There is a common mis-understanding here. 2008 will be the last year oracle is going to support Developer in Client server mode. Oracle does not claim to discontinue Developer, They are currently working on Developer Rel9i, which is truely a multi tiered archtecture. PLSQL will live as long as Oracle database lives.
    PLSQL is simple yet powerful language, it is getting better with each version. With the new 9i release, it is truely object oriented like any OO language like Java/C etc. Further you can override methods in Objects and override them in C, Java, PLSQL etc. What this means is that you can have a parent Object and have some method x implemented in PLSQL, you can then inherit another object from the parent object and override the same method x, this time you can write the method x in java or C. No other language can offer this feature. Further PLSQL also provides you with dynamic typing, like most other OO languages. These are some of the features of PLSQL.
    And ofcourse, the language you choose is purely a matter of choice. If you are going to write a database-centric application, PLSQL might be a right choice as it facilitates many things for us like exception handling, transaction etc.
    If you are writing a generic application that can interact with any database, then java might be a right choice as you and encapsulate the information in the language.
    HTH
    Arvind Balaraman

  • Executing a stored procedure from a java program

    Hi.. how can i call a oracle stored procedure from a java
    program. the OSP has four IN parameters and one OUT parameter(a
    cursor). when i try this way.. i get an error
    con = DriverManager.getConnection(url, "stored", "stored");
    CallableStatement cs =
    con.prepareCall(
    "{call stored_proce_1(?,?,?,?,?)}");
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.setString(2, "14541");
    cs.setString(3, "gen");
    cs.setInt(4, 0);
    cs.setInt(5, 5);
    ResultSet rs =cs.getResultSet();
    while(rs.next()){
    System.out.println(rs);
    appreciate ur help.
    qs

    I'm no expert on this, but I have a similar call where I fetch
    an Oracle REF CURSOR from a call to a stored function. If you
    fetch the cursor as an Object from your CallableStatement, you
    can then cast it to a ResultSet e.g.
    mystatement.executeUpdate();
    ResultSet rs = (ResultSet) mystatement.getObject(1);
    Then you should be able to loop through your ResultSet as usual.
    Good luck!
    Chris

  • Can't see stored procedure in database explorer

    I'm using mysql 5.0. When I expan the database in database explorer, I can see only tables.  Stored procedure folder is shown there but when i try to expand it..nothing inside it.  
    Anyone knew the solution,  Could u please help??!
    Thanks in advance.

    You'll need to publish the site to your remote server and post a URL here to get any help.  It could be you're testing locally and IE browser security is getting in the way.  Or it may be due to a missing file on server, etc...
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists
    www.alt-web.com/
    www.twitter.com/altweb
    www.alt-web.blogspot.com

  • Java stored procedures

    I want to use Java stored procedures .
    My Java file is dependent on many imported files .
    These dependent files are residing in middle layer .
    I do not want to Place this dependent files into the database.
    Can any one Please suggest me a method where i can make my Java code stored in database Running without storing this dependent files in the database.
    Thanks.

    Nope. You will have to have the dependent classes also stored in the database. Without this, your java file won't get stored in DB.
    --Shiv                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • Sorry, this content is not allowed when trying to post.

    Hi all, With text like NVL, tmp when wrapped between <code>....<code> ? For actual posting, had used {  } instead of < > for the above. Any workaround ? Regards Zack

  • Bit rates in Compressor using H264

    I have an HD media player that can only handle files up to 4GB (fat32). I need to compress 30 minutes of 1080P HD footage to around 3.6 GB. The problem I keep running into is the complex footage in the finished video. I'm trying to create a H264 file

  • Material based invoice split

    Hi I have a requirement to split invoice based on a particular material. In a sales order there are 3 materials say X, Y and Z. When i create a invoice followed by a delivery the invoice should be splitted into 2. 1 for materials X and Z and another

  • Apache, virtual hosts & cgi-bin

    Hello all, I have an AL server running apache, qmail, vpopmail (&mysql), bincimap, squirrelmail. I've setup apache to have 2 virtual hosts : www.mydomain.com (with docroot /home/httpd/html/www.mydomain.com) as http & mail.mydomain.com (with docroot /

  • Acquiring Adobe Software

    Hello world, I'm starting a new business of printing, and I'm looking for a solution of Photoshop and Illustrator, but I can't find any. As an individual I can get both easily but for a small business I have to buy the full package (with dreamweaver,