Java stored proc from proxy Java classes generated from a web service?

Hi gurus,
I have searched "Java Stored Procedure" on this forum but could not find what I am looking for, so I have to post again.
I need to use a web service and my client app is written in PowerBuilder 11 (Sybase), which claims that it will create a datawindow from a web service. Well, it turned out that PB can only handle simple stuff (it works with a very simple wsdl from the internet) but can't handle more complex ones that we need to use. So I am thinking about using Oracle JDeveloper(JDev) to create the web service proxy for the web service and then load it into Oracle as a Java stored procedure so that PowerBuilder can call the procedure. JDev succsfully generated the proxy and a few Java classes. My question is, do I need to load all the classes into the database? If yes, will the reference to the package work? For example, in a JDev generated class (the soap client class), it has package MyJdev.proxy; at the top. Or, will it work if I load all the classes included in package /MyJdev/proxy into the database?
Thank you very much for any help.
Ben

For the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
CREATE OR REPLACE PACKAGE MyPackage AS
TYPE Ref_Cursor_t IS REF CURSOR;
FUNCTION get_good_ids RETURN VARCHAR2 ;
FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
END MyPackage;
CREATE OR REPLACE PACKAGE BODY MyPackage AS
FUNCTION get_good_ids RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'MyServer.getGoodIds() return java.lang.String';
FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
IS table_cursor Ref_Cursor_t;
good_ids VARCHAR2(100);
BEGIN
good_ids := get_good_ids();
OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' | | good_ids | | ')';
RETURN table_cursor;
END;
END MyPackage;
public class MyServer{
public static String getGoodIds() throws SQLException {
return "1, 3, 6 ";
null

Similar Messages

  • Can I  load Java classes generated by the Web Service Proxy Wizard?

    Hi gurus,
    I am very new to Oracle JDeveloper and I have mainly used it to create and debug PL/SQL procedures. My client app is written in PowerBuilder 11 (Sybase), which claims that it will create a datawindow from a web service. Well, it turned out that PB can only handle simple stuff (it works with a very simple wsdl from the internet) but can't handle more complex ones that we need to use. So I am thinking about using JDev to create the web service proxy for the web service and then load it into Oracle as a Java stored procedure so that PowerBuilder can call the procedure. JDev succsfully generated the proxy and a few Java classes. My question is, do I need to load all the classes into the database? If yes, will the reference to the package work? For example, in a JDev generated class (the soap client class), it has package MyJdev.proxy; at the top. Or, will it work if I load all the classes included in package /MyJdev/proxy into the database?
    Thank you very much for any help.
    Ben

    Thanks again, Bruce.
    What I meant by SOAPElement is that one genereated Java class has this and this class also has the setter for this like this,
    public void setSelection(javax.xml.soap.SOAPElement selection) {
    this.selection = selection;
    And here is the whole class,
    public class CaseSearchByPartyRequest implements java.io.Serializable {
    protected java.lang.String schemaVersion;
    protected java.util.Calendar messageProducedDateTime;
    protected javax.xml.soap.SOAPElement selection;
    protected Restriction restriction;
    public CaseSearchByPartyRequest() {
    public java.lang.String getSchemaVersion() {
    return schemaVersion;
    public void setSchemaVersion(java.lang.String schemaVersion) {
    this.schemaVersion = schemaVersion;
    public java.util.Calendar getMessageProducedDateTime() {
    return messageProducedDateTime;
    public void setMessageProducedDateTime(java.util.Calendar messageProducedDateTime) {
    this.messageProducedDateTime = messageProducedDateTime;
    public javax.xml.soap.SOAPElement getSelection() {
    return selection;
    public void setSelection(javax.xml.soap.SOAPElement selection) {
    this.selection = selection;
    public Restriction getRestriction() {
    return restriction;
    public void setRestriction(Restriction restriction) {
    this.restriction = restriction;
    this.selection is the request that I think I need. And here is the static main method of the soap client class genereated.
    public static void main(String[] args) {
    try {
    MyJdev.proxy.SoapClient myPort = new MyJdev.proxy.SoapClient();
    System.out.println("calling " + myPort.getEndpoint());
    // Add your own code here
    } catch (Exception ex) {
    ex.printStackTrace();
    So, if I need to send the request to the web service, do I need to create the request, correct? I have done it through AQ and Messaging Gateway and works fine by manually creating the request xml in PL/SQL, but now I need to get it to work sychronously from the UI. I believe that I need the request (SOAPElement) because that is the only way that I can supply the parameters. I have not see any setters for the parameters other than some setters for user name and password.
    Did I get something wrong here? If I don't supply the "selection", will JDev do it?
    Thanks.
    Ben

  • Calling an EJB deployed in OC4J from Java Stored Proc in Oracle

    Hello!
    Trying to make a call to an EJB deployed in OCJ4 from a oracle java stored proc. After loaded orion.jar and crimson.jar lib into SCOTT schema, I can't get the JNDI Context working because of this error:
    ============================================
    javax.naming.NoInitialContextException: Cannot instantiate class:
    com.evermind.server.ApplicationClientInitialContextFactory. Root exception is
    java.lang.ClassNotFoundException:
    com/evermind/server/ApplicationClientInitialContextFactory
    at java.lang.Class.forName0(Class.java)
    at java.lang.Class.forName(Class.java)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:45)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java)
    at javax.naming.InitialContext.init(InitialContext.java)
    at javax.naming.InitialContext.<init>(InitialContext.java)
    ===============================
    I did load the java with "loadjava" with on time with the "resolve" option and time time no option and still no working.
    Here is the EJB client code:
    =======================================
    import java.sql.*;
    import java.util.*;
    import javax.naming.*;
    import com.evermind.server.ApplicationClientInitialContextFactory;
    class EmpRemoteCall {
    public static void main(String[] args) {
    System.out.println(getEmpName());
    public static String getEmpName() {
    String ejbUrl = "java:comp/env/ejb/Emp";
    String username = "admin";
    String password = "admin";
    Hashtable environment = new Hashtable();
    environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.ApplicationClientInitialContextFactory");
    environment.put(Context.PROVIDER_URL, "ormi://127.0.0.1/testemp");
    environment.put(Context.SECURITY_PRINCIPAL, username);
    environment.put(Context.SECURITY_CREDENTIALS, password);
    //environment.put(Context.SECURITY_AUTHENTICATION, ServiceCtx.NON_SSL_LOGIN);
    //environment.put(javax.naming.Context.URL_PKG_PREFIXES, "oracle.aurora.jndi");
    com.kboum.sertir.essais.EmpHome homeInterface = null;
    try {
    Class.forName("com.evermind.server.ApplicationClientInitialContextFactory", true, ClassLoader.getSystemClassLoader());
    System.out.println("Creating an initial context");
    Context ic = new InitialContext(environment);
    System.out.println("Looking for the EJB published as 'java:comp/env/ejb/Emp'");
    homeInterface = (com.kboum.sertir.essais.EmpHome) ic.lookup(ejbUrl);
    catch (CommunicationException e) {
    System.out.println("Unable to connect: " + ejbUrl);
    e.printStackTrace();
    //System.exit(1);
    catch (NamingException e) {
    System.out.println("Exception occurred!");
    System.out.println("Cause: This may be an unknown URL, or some" +
    " classes required by the EJB are missing from your classpath.");
    System.out.println("Suggestion: Check the components of the URL," +
    " and make sure your project includes a library containing the" +
    " EJB .jar files generated by the deployment utility.");
    e.printStackTrace();
    //System.exit(1);
    catch (ClassNotFoundException e) {
    System.out.println("Unable to connect: " + ejbUrl);
    e.printStackTrace();
    //System.exit(1);
    try {
    System.out.println("Creating a new EJB instance");
    com.kboum.sertir.essais.Emp remoteInterface = homeInterface.findByPrimaryKey(Integer.valueOf("7369"));
    System.out.println(remoteInterface.getENAME());
    System.out.println(remoteInterface.getSAL());
    remoteInterface.setSAL(2);
    System.out.println(remoteInterface.getSAL());
    return remoteInterface.getENAME();
    catch (Exception e) {
    System.out.println(e.getMessage());
    e.printStackTrace();
    return "error";
    null

    What I did to solve this problem was to
    create a simple RMI remote object that
    resides outside the database JVM and that
    serves as a proxy EJB client for your java
    stored procedure. The stored procedure can
    invoke a method on the remote RMI object
    which then looks up the EJBean's home
    interface and invokes the relevant method on
    the bean's remote interface, and relays any
    return values back to the java stored
    procedure.
    Hope this helps,
    Avi.
    null

  • JNDI lookup from a Java stored proc?

    Anybody know if a JNDI lookup, or accessing an EJB from a Java stored procedure is possible? I looked through all the docs and it says it is possible but doesn't specify how. In the java class thats resolved through the stored proc, how are the server generated classes and interfaces made available? Normally setting the classpath for the client app that does the lookup accomplishes this, but what if its called through the stored proc?

    check the rdbms platform's "javavm" folder for a "readme.txt" file ...
    In section 3.16.9, it discusses how to do this ...

  • Can we call a Java Stored Proc from a PL/SQL stored Proc?

    Hello!
    Do you know how to call a Java Stored Proc from a PL/SQL stored Proc? is it possible? Could you give me an exemple?
    If yes, in that java stored proc, can we do a call to an EJB running in a remote iAS ?
    Thank you!

    For the java stored proc called from pl/sql, the example above that uses dynamic sql should word :
    CREATE OR REPLACE PACKAGE MyPackage AS
    TYPE Ref_Cursor_t IS REF CURSOR;
    FUNCTION get_good_ids RETURN VARCHAR2 ;
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t;
    END MyPackage;
    CREATE OR REPLACE PACKAGE BODY MyPackage AS
    FUNCTION get_good_ids RETURN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'MyServer.getGoodIds() return java.lang.String';
    FUNCTION get_plsql_table_A RETURN Ref_Cursor_t
    IS table_cursor Ref_Cursor_t;
    good_ids VARCHAR2(100);
    BEGIN
    good_ids := get_good_ids();
    OPEN table_cursor FOR 'SELECT id, name FROM TableA WHERE id IN ( ' &#0124; &#0124; good_ids &#0124; &#0124; ')';
    RETURN table_cursor;
    END;
    END MyPackage;
    public class MyServer{
    public static String getGoodIds() throws SQLException {
    return "1, 3, 6 ";
    null

  • Can't execute OS-level command from java stored proc

    I've written a couple simple java stored procs, the first of which writes an file and the second attempts a chown on it. I can write the file (which is written as the oracle user) just fine. I need to chown it, but can't. Here's the first proc:
    public static String writefile()
    String fileName = "/joetest/test.xml";
    try {
    File f = new File(fileName);
    FileOutputStream out = new FileOutputStream(f);
    PrintStream p = new PrintStream(out);
    p.println("this is only a test");
    p.close();
    return "create file successful!!!";
    } catch (Exception e) {
    return "Exception occurred writing file:"+e;
    Here's the proc I've been stuggling with:
    public static String chown(String inString)
    String[] command = {"/bin/sh", "-c", "/usr/bin/chown notjoe /joetest/test.xml"};
    if (inString != null) {
    command[2] = inString;
    try {
    Process p = Runtime.getRuntime().exec(command);
    return "Ownership change success!! "+p;
    } catch (Exception e) {
    return "Ownership change failure?? err="+e;
    The package is created with:
    CREATE OR REPLACE PACKAGE JOE.THISISATEST AS
    FUNCTION writefile
    return VARCHAR2
    AS
    LANGUAGE java
    NAME 'thisisatest.writefile() return java.lang.String';
    FUNCTION chown(Param1 VARCHAR2)
    return VARCHAR2
    AS
    LANGUAGE java
    NAME 'thisisatest.chown(java.lang.String) return java.lang.String';
    end;
    And I've granted the following privileges:
    begin
    dbms_java.grant_permission('JOE', 'java.io.FilePermission', '/joetest/test.xml', 'read, write, execute, delete');
    end;
    begin
    dbms_java.grant_permission('JOE', 'java.io.FilePermission', '/usr/bin/chown', 'execute');
    end;
    begin
    dbms_java.grant_permission('JOE', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    end;
    begin
    dbms_java.grant_permission('JOE', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    end;
    Here's the error that I'm getting:
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Coincidentally, this is the same error that I used to get when I wrote the file without having been granted write privileges. Once I granted myself the proper 'write' permissions I could perform file IO just fine. Is there some runtime permission that I need to grant myself to run chown? I'm just guessing, as I can't find any permission like that in the java documentation. I have 'execute' permission on /usr/bin/chown and the oracle user can execute the command I'm attempting from the command line. ARRRRRGH.
    I am at my wits end with this. I've tried what seems like a thousand different syntaxes for the OS command and ran it from many different directories. Anyone have any thoughts at all as to why this is happening? I'm just clutching at straws now...

    Hmmmm. Granting 'execute' on '<<ALL FILES>>' to user JOE fixes this problem:
    begin
    dbms_java.grant_permission('JOE', 'java.io.FilePermission', '<<ALL FILES>>', 'execute');
    end;
    My security folks will not allow this when I port to production, but at least it is something.
    Message was edited by:
    user603023

  • Java stored proc status

    hello.
    What would trigger the change of "STATUS" from valid to invalid
    for a java stored procedure (status of the PROCEDURE, not the
    java class/source)?
    E.g.
    - loaded a java source/class
    - published it with CREATE PROCEDURE ...
    - the procedure inserts a row into some table X
    - select* from user_objects where object_type = 'PROCEDURE'; shows that
    the proc is valid
    - call the proc, fine
    - delete a column from the table X
    - select* from user_objects where object_type = 'PROCEDURE'; shows that
    the proc is still VALID
    - call the proc, the call actually completed without error! (but the new row didn't get inserted into the table)
    When the schema of a table that a java stored proc refers
    to changes, will the java stored proc automatically marked
    as "INVALID"? If not, when will this status changed from
    VALID to INVALID?
    Thanks.
    Min

    Min:
    A java stored procedure is marked as VALID or INVALID depending on whether Oracle had any problems loading the class file into the database. Since you had no problems loading the class file it will always be valid.
    Now, after you deleted the column in the table I would assume that the java stored procedure would have a problem when it tried to do an insert and it would throw an exception. Your java stored procedure is VALID, it just isn't executing properly and is more than likely throwing an exception.
    Sometimes an exception thrown from a jsp is written to a log file instead of to the console. I suspect that this is the case in your situation. You think that the call to the jsp executed with no errors, but I bet it didn't. You will probably find the errors somewhere in the oracle\ora90\admin\mydatabase directory. Look at the latest .trc file. (Note: the path I gave to the .trc files may be different depending on what version of oracle you are using).

  • How to publish a Java Stored proc....

    Hi,
    I wrote the following Java code and loaded it into Oracle 8i, as Java stored procs.
    public class EmployeeStruct
    public int EmployeeNum;
    public String EmployeeName;
    public String Designation;
    and
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    public class InsertData
    public static InsertEmployee(EmployeeStruct eps) throws SQLException
    Connection conn =
    DriverManager.getConnection("jdbc:default:connection:");
    String sql = "INSERT INTO EMPLOYEE_TABLE VALUES (?, ?, ?)";
    try
    PreparedStatement pstmt = conn.prepareStatement(sql);
    pstmt.setInt(1, eps.EmployeeNum);
    pstmt.setString(2, eps.EmployeeName);
    pstmt.setString(3, eps.Designation);
    pstmt.executeUpdate();
    pstmt.close();
    catch (SQLException e)
    System.out.println(e.getMessage());
    My question is how do I publish the InsertData proc. I tried :
    CREATE OR REPLACE PROCEDURE insert_data (e EMPLOYEESTRUCT) AS LANGUAGE JAVA
    NAME 'INSERTDATA(EmployeeStruct)';
    but this gives me PLS-00201, identifier EmployeeStruct must be declared.
    COULD SOMEONE HELP ME/ SHOW ME HOW ?
    I wish to call the java stored proc from an external java program.
    rgds
    Jeevan S
    null

    You can't pass Java classes to Java Stored Procedures via the PL/SQL wrapper. You'll have to write your wrapper to take the int as a NUMBER and the two Strings separately as VARCHAR2s, e.g.:
    CREATE OR REPLACE PROCEDURE insert_data
    EmployeeNum IN NUMBER,
    EmployeeName IN VARCHAR2,
    Designation IN VARCHAR2
    AS LANGUAGE JAVA
    NAME 'InsertData.InsertEmployee(int, java.lang.String, java.lang.String)';
    John H.
    null

  • Do Java Stored Proc support GUI

    Calling Java stored procedure from database Trigger
    I tried three things individually in Java Stored proc after
    trigger is fired:
    1. Do SQL statement (Insert into ... )
    2. Execute a command to open notepad screen.
    3. Open a new Frame and display it.
    These three are simple testing, Item 1 works fine, however,
    Item 2 and 3 never works.
    IS JAVA STORED PROC CAN ONLY DO SQL TYPES OF WORK (INSERT, DELETE, UPDATE) ?
    The errors I have for Items 2 and 3 are like:
    1. When loading java: Java call terminated by uncaught Java exception:
    oracle.aurora.awt.UnsupportedOperation:GUI not supported.
    2. When triger is fired: class SCOTT.DBTrigger could not be resolved.
    Thanks for help !!

    As far as I know java stored procedures can't use any GUI classes. Only unvisible actions!
    Regards

  • Problem with java stored procs.

    Is there a restriction on accessing XML documents from Java stored procs?
    I have a Java program to parse XML document and return a string. If I run this program as a stand alone, the program runs fine.
    I loaded the oracle xmlparser.jar into ORACLE8i db sucessfully (used -resolve option). Then I loaded my .class file with -verbose and -resolve option and I did not get any erros. I created function which return string. When I ran the function, I did not get any value bacmk.
    Can I use System.out.println in java programs in ORACLE8i. If I can where can I see the output when the program runs? I not waht other mehtods I can use to debug the program running in ORACLE8i JVM.
    Thank You

    Hello again,
    I read the documentation of 9i and found some hints about different TCP/IP socket handling of 9i and a standard JVM.
    There are some parts that give hints but I couldn't find a sample code to show how to handle the differences.
    Could anyone tell me how to handle the differences or give some links to sample code?
    Thanks
    Detlev

  • System calls through Java stored Proc

    Hi,
    Aim: Execute host command from pl/sql thru java stored proc.
    1. Created a java class to take system command that could be executed.
    2. It runs fine when the class file is executed.
    3. when the java file is loaded to database to access it as java stored proc, for any valid and invalid system commands it is giving out 'PL/SQL successfully completed.
    Results were not seen.
    4. Java source file.
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static int RunThis(String[] args) {
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    String s = null;
    try
    Process p = rt.exec(args);
    BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
    BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
    // read the output from the command
    System.out.println("Here is the standard output of the command:\n");
    while ((s = stdInput.readLine()) != null) {
    System.out.println(s);
    // read any errors from the attempted command
    System.out.println("Here is the standard error of the command (if any):\n");
    while ((s = stdError.readLine()) != null) {
    System.out.println(s);
    System.exit(0);
    catch (Exception e){
    e.printStackTrace();
    rc = -1;
    finally {
    return rc;
    public static void main(String[] args){
    Util.RunThis(args);
    public static String exec(String args){
              Util.RunThis(args);
              return "Srini it is successful";
    5. When ran from host prompt (unix),
    executed successfully,
    $ /opt/java1.3.1/bin/java Util /usr/bin/ls -l
    Here is the standard output of the command:
    total 30862
    -rwxrwxrwx 1 xyz develope 1348218 Jan 2 17:47 02Jan03-2.zip
    -rw-r----- 1 xyz develope 21864 Jul 9 2002 109-60_2_modified7.sql
    -rw-r----- 1 xyz develope 44934 Jul 9 2002 109-60_2_modified8.sql
    Here is the standard error of the command (if any):
    xyz@xxxxx:abcd:/home/xyz
    $
    6. loadjava,
    $ loadjava -user username/password Util.java
    7. Create proc,
    SQL> create procedure echo_input(s1 varchar2) as language java name 'Util.main(java.lang.String[])';
    2 /
    Procedure created.
    8. Execute proc.
    SQL> exec echo_input('/usr/bin/ls -l');
    PL/SQL procedure successfully completed.
    SQL> exec echo_input('/home/o_report/reports/rcli_ASCT &');
    PL/SQL procedure successfully completed.
    SQL> set serverout on
    SQL> exec echo_input('/home/o_report/reports/rcli_ASCT');
    PL/SQL procedure successfully completed.
    SQL> exec echo_input('ddsafafasf');
    PL/SQL procedure successfully completed.
    TIA,
    Srini.

    Hi Srini,
    This is just a suggestion, but try entering the following commands (in your SQL*Plus session) before executing your stored procedure:
    set serveroutput on size 1000000
    exec dbms_java.set_output(1000000)Hope this helps.
    Good Luck,
    Avi.

  • ORA-03113 error when running the Java stored proc demos

    Hi there,
    Has anyone else run into this issue. When attempting to transfer an object type from Java to Oracle - through a Java stored proc - the session crashes with:
    ORA-03113: end-of-file on communication channelLooking in the trace file generated the error message looks something like:
    ksedmp: internal or fatal error
    ORA-07445: exception encountered: core dump [0x8fe04468] [SIGTRAP] [unknown code] [0x8FE59034] [] []
    Current SQL statement for this session:
    select pointruntime.jdistance(point(1, 2), point(2, 3)) from dual
    ----- Call Stack Trace -----
    calling              call     entry                argument values in hex     
    location             type     point                (? means dubious value)    
    ksedmp+764           call     ksedst               0 ? 2C4F4A ? 2C ? 98968000 ?
                                                       DB02C ? 27A50000 ?
    ssexhd+956           call     ksedmp               3 ? 0 ? 8FE5E790 ? 5905870 ?
                                                       8FE0434C ? 40895E4 ?
    0x9012c860           call     ssexhd               5 ? BFFEEF70 ? BFFEEFB0 ? 0 ?
                                                       0 ? 0 ?As you can see from the trace snippet above, I was attempting to run one of the Oracle Java stored procedure demos. Has anyone successfully run those demos? Specifically the ones where complex types (table objects or the Point object) are passed back to Oracle from the JVM.
    I would appreciate some help with this. The code works fine in a Windows or Solaris environment but barfs on Apple. Truly annoying....
    Anyone?
    Thanks in advance,
    Alex

    Yes,
    Apologies for not stating that information, Steve. Was a bit naughty of me! I guess the reason I didn't was because I just wanted to hear if anyone else running Oracle on Mac received such errors when executing the Java stored proc demos (specifically, the execution of PointRuntime.jDistance). Nevertheless, here's the relevant info from the trace file:
    Dump file /Users/oracle/admin/sandbox/udump/sandbox_ora_1861.trc
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
    ORACLE_HOME = /Users/oracle/product/10.1.0/db
    System name:     Darwin
    Node name:     maczilla.local
    Release:     8.3.0
    Version:     Darwin Kernel Version 8.3.0: Mon Oct  3 20:04:04 PDT 2005; root:xnu-792.6.22.obj~2/RELEASE_PPC
    Machine:     Power Macintosh
    Instance name: sandbox
    Redo thread mounted by this instance: 1
    Oracle process number: 10
    Unix process pid: 1861, image: [email protected] for the Java version, according to the readme file in the javavm directory, I am running 1.4.1:
    1.5  Java Compatibility
    This release has been thoroughly tested with Sun's Java Compatibility
    Kit for the JDK 1.4.1. Oracle is committed to OracleJVM keeping pace
    with Java and other Internet standards.

  • Parse XML in a java stored proc

    I am trying to parse an xml document in a java stored procedure. Just following my nose, I have developed a stored proc that works fine in development (outside the database using JRE 1.4.1) using the Xerces 2.5 parser. But, after having transferred the xerces xercesImpl.jar, xmlapis.jar, and my implementation class into oracle using loadjava when I call my stored proc the code throws an exception trying to build the document with an error like:
    NoClassDef exception org.apache.xerces.jaxp.DocumentFactoryBuilderImpl
    My Code looks like this:
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import org.w3c.dom.Document;
    import org.xml.sax.SAXException;
    InputStream is = getXMLAsInputStream(xml);
    try {
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document document = builder.parse( is );
    ... parse the document ....
    catch (FactoryConfigurationError e) {
    // unable to get a document builder factory
    The exception caught is a FactoryConfigurtionError.
    I'm not particularly attached to xerces, I'm really just looking for a way to parse XML inside my java stored proc, so any help to solve my problem, or an alternative suggestion will be greatly appreciated.
    thanks
    Dale

    I looked again and sure enough the xerces implementation classes were missing. I had run a .cmd file containing these two lines, but it looks like only the first one ran...
    loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xml-apis.jar
    loadjava -u ncc/xyz@usd -v -r M:\Database\JavaGeocode\Xerces2_5_0\xercesImpl.jar
    Now I've got everything working fine with Xerces!
    Dale

  • Java Stored Proc and Oracle 8.0.6.20?

    Hi,
    I have a customer using Oracle 8.0.6 (on multi-platforms). We'll need to implement a pl/sql which needs to execute an external script.
    My understanding is there are only 2 ways to achieve this: (a) use Java stored procedure, (b) use C/C++ library
    Question 1: Is Java Stored Proc available in 8.0.6?
    Question 2: Is there anywhere I can download Oracle 8.0.6 (Windows, or Tru64, Linux)?
    - Will

    java in the database was introduced from Oracle8i onwards. this version of Oracle does not support java virtual machine in the database.
    You would need to use C/C++ external procedures.

  • How to pass a refcursor to a java stored proc

    Hi all,
    Please forgive me as I am new to Java and JDeveloper....
    I want to pass a refcursor to a java stored proc. Does anyone know how to accomplish this?
    Thanks,
    dayneo

    Hi,
    As Avi has indicated, you can map ref cursor to java.sql.ResultSet
    here are Call Specs and a code snippet from chapter 3 in my book.
    procedure rcproc(rc OUT EmpCurTyp)
    as language java
    name 'refcur.refcurproc(java.sql.ResultSet[])';
    function rcfunc return EmpCurTyp
    as language java
    name 'refcur.refcurfunc() returns java.sql.ResultSet';
    * Function returning a REF CURSOR
    public static ResultSet refcurfunc () throws SQLException
    Connection conn = null;
    conn = DriverManager.getConnection("jdbc:oracle:kprb:");
    ((OracleConnection)conn).setCreateStatementAsRefCursor(true);
    Statement stmt = conn.createStatement();
    ((OracleStatement)stmt).setRowPrefetch(1);
    ResultSet rset = stmt.executeQuery("select * from EMP order by empno");
    // fetch one row
    if (rset.next())
    System.out.println("Ename = " + rset.getString(2));
    return rset;
    Kuassi

Maybe you are looking for

  • Creation Indicator in PR: B Material Requirement planning

    Hi All, I am facing an unusal scenario. User is claming that PR is getting generated for a material after running the MRP, even there is enough stock. I checked material &  I found that MRP type is ND, there is no entry in the planning file for this

  • Message getting stuck in SMQ2 for proxy

    Hi All,     I am facing one problem in inbound queue of proxy scenario.   Some times messages are in scheduled status. In the trace i can see the following message. <Trace level="1" type="T">--no sender or receiver interface definition found</Trace>

  • Any reason NOT to reinstall OS X?

    I just got my PB back from repair. I guess when they put in the new harddrive they just "registered" it as ( ...a's PowerBook... ) I went to change that to (.. Spencer's Powerbook...) but now it seems that some things recognize "Spencer's" and some r

  • Exclude a url from a protected ressource

    Hi, is there a chance to configure in the policy agent oder in the access manager an exclude url. For example. http://domain.tld is the protected ressource http://domain.tld/protected.html is a protected url and if you want to show it, you where redi

  • Report execute time nd how many records will be returned before hitting the "run" option?

    Post Author: Prasad15 CA Forum: WebIntelligence Reporting Is there any way to know how long the report executes and how many records will be returned before hitting the "run" option? Regards Prasad