XML and Java Store Procedures

I have written JDBC Classes that are using OracleXMLObject and they are successfully working outside of Oracle.
I can successfully load them and create procedures for them. But, when I call them, I'm told that method does not exist.
Please help, can you provide a working example?
Regards,
Bruce

<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark Abram ([email protected]):
Can you post some snippets of your code
so we can have a better idea what you trying to do?<HR></BLOCKQUOTE>
Dear Mark,
Here is the code:
import java.sql.*;
import java.math.*;
import oracle.xml.sql.query.*;
import oracle.jdbc.*;
import oracle.jdbc.driver.*;
//Title:
//Version:
//Copyright: Copyright (c) 1999
//Author: Bruce Kearney
//Company: Atrion International
//Description:
public class IncidentTypeDB {
// public static void main(String args[]) throws SQLException
public void getEverything()
try
Connection connection = new OracleDriver().defaultConnection();
OracleXMLQuery query = new OracleXMLQuery(connection, "select " +
"incidenttypeidseq, incidenttype from incident_type");
query.setMaxRows(query.MAXROWS_ALL);
query.setRowsetTag("ROOTDOC");
query.setRowTag("DBROW");
String xmlString = query.getXMLString();
System.out.println(xmlString);
connection.close();
} catch (SQLException e)
System.out.println("Error retrieving record.");
System.out.println(e.toString());
return;
} catch (Exception e)
System.out.println("Error connecting to database.");
System.out.println(e.toString());
return;
Regards,
Bruce
null

Similar Messages

  • Need help on processing XML doc using Java store procedure

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

    I am currently working on project to read, parse XML document and store data in XML document into database columns. I use JAVA API-OracleXMLSave in my java store procedure to do it, which use URL of XML doc to read, parse doc and store the data to database columns. My java store procedure works fine when XML doc is saved in server, but got "ORA-29532: Java call terminated by uncaught Java exception:
    oracle.xml.sql.OracleXMLSQLException: No such file or directory" if XML doc is in client's PC instead of in server. I think the problem comes from the URL that created using OracleXMLSave
    --createURL(fileName) based on the filename. what will be the filename if XML document located in Client PC like C:\myprojects\xmldoc.xml?
    Thank you in advance if anyone can give some hints.

  • Oracle Java Store Procedure and JNI

    Hi ! 'Is the anybody out there ?'
    We don't know. We are developing a java store procedure in Oracle 9i. We need to use a propetary .so file about cript/decript information (entrust file). So have to use in oracle a .jar file with all software infrastructure that use this .so file. But, we have a problem. 'Cause, in windows, we can use a .dll file from our java store procedure, but when we run under unix aix, we have problem about jni.
    java.library.path in oracle console is empty.
    So we cannot find our share object... have you got an idea ?
    thanks!!
    andrea

    Oracle lite does not support the use of PL/SQL procedures or triggers in the database, so unfortunately you just cannot use them.
    as an alternative you need to either
    a) include the setting on the client records when they are created
    b) use before insert/update triggers on the main oracle database to populate the columns. NOTE if doing this you will find that the user that is actually responsible for the inserts and updates to the main database is MOBILEADMIN (as it is running the apply process. If you just want to log the fact that it was client created fine, but will not tell you the creating user)
    c) you should be able to use pure java stored procedures on the client (if in the main oracle database, they should replicate across, but beware of jvm differences and any advanced stuff that may not be supported. you will also have to get any necessary jar files over to the client as well)
    We have used method a) as a standard method called for all inserts/updates in the java client APPLICATION software based on the existance of the audit columns, rather than within the database as it is simpler

  • Java Store Procedures

    Hi Guys,
    Does anyone know if it is possible to implement a java store procedure that will be subsequently called in a "select" operation within a "where" statement in Oracle 9R2?
    Thanks,
    Andrea

    Hi Andrea,
    From your sample code, I get the impression that you aren't too familiar
    with Oracle (and perhaps even databases in general?). This leads me
    to believe that you are looking for someone who will do your work for
    you. If that is the case, then I suggest you employ an independent
    contractor (or consultant) who, I'm sure, will be more than happy to
    accomodate you -- and I'm sure will do a much better job than I can
    (via this forum).
    Please forgive me if my interpretation is incorrect, however I feel,
    that with a little effort on your behalf, you can find the solutions
    to your problem by looking through the Oracle documentation, sample
    code and "how-to" documents that are available from Oracle's "Technet"
    web site:
    http://technet.oracle.com
    If, after that, you run into a specific problem, then please ask a
    specific question on this forum and I will try to provide a specific
    answer (if I can :-).
    Good Luck,
    Avi.

  • JAVA STORE PROCEDURE

    Hi all,
    My question is suppose my java store procedure tries to open an socket with an IP address/port number. What r the priviledges does the "USER" needs to run the procedure?
    If that priviledes has not grant to the user, then what will be the error should throw by Oracle?

    try the following :
    SYSTEM User needs to perform
    call dbms_java.grant_permission('CANDS_QA', 'java.util.PropertyPermission',
    '*','read,write');
    commit;
    then try your code again.
    null

  • NEW TO XML AND JAVA

    hi, I'm new to xml, actually I'm taking a course in xml and I should choose a certain project related to xml.
    I want to ask about xml and java
    the things that I know about java is some classes ( I made a program of bouncing ball in java and changed some java game programs). but I need to know how to use java in databases and how to relate it to xml
    Is it too dificult or I can learn it knowing that I'm ready to learn and already I'm learning xml.
    If anyone wants to help me please send me links to some websites where it is simple to learn java .
    Also if any one can give me an example of a certain project that can be done easily using java and xml u'll be more than welcome

    Check the JAVA XML Tutorials provided by the Java Site.

  • How to load and define Java Store Procedures using Consolidator Manager??

    Hi,
    I am trying to create a store procedure with a very easy example and I can not succeed. i am a bit new with OLite and I will appreciate any help from your side. I am quite lost now regarding of using java with OLite and it is becoming quite urgent for me. Thanks a lot in advanced.
    Those are the steps that I follow:
    - Creating the java class
    I create the java file MYUPPER.java with next code :
    public class MYUPPER {
    public static String doUpper( String p_text )
    return p_text.toUpperCase();
    I compile it and I create the jar file:
    C:\>javac MYUPPER.java
    C:\>jar cf MYUPPER.jar MYUPPER.class
    - This is an abstract of my java code using the API:
    ( m_cm is ConsolidatorManager)
    // Create the java resource
    m_cm.createStoredProc( "MYUPPER.jar", "MYUPPER", "doUpper", "doUpper");
    // Add it to the publication
    m_cm.addJavaResource( "PMTS", "MYUPPER" );
    - After running that code I do not receive any exception and checking into the repository looks ok:
    a) From the Mobile Server I can see the Java Ressource MYUPPER for that publication
    b) I can see the entries in C$Resouces and in C$Pub_Objects as well
    *** ON THE CLIENT:
    Then I go to the client device a Windows XP labtop where I did install the jre 5.0 and I added the bin path to the system variable PATH.
    - I get a POL-8000 error when synchronizing (could not start the Java Visrtual Machine)
    - Anyway, I can see the MYUPPER.class file deployed in the same directory than the databases are.
    - I have also tried next from msql:
    c:\>msql system/manager@jdbc:polite:tomeu_conscli
    Oracle Lite MSQL Version 10.3.0.2.0
    Copyright (c) 1997, 2008, Oracle. All rights reserved.
    Connected to: Oracle Lite ORDBMS
    Database Name: CONSCLI (Read Write)
    Database Version: 10.3.0.2.0
    Auto Commit: off
    Driver Name: oracle.lite.poljdbc.POLJDBCDriver (OLite 4.0)
    SQL> select * from c$resources;
    PUB_NAME | DB_NAME | RESOURCE_NAME | RESOURCE_TYPE | RESOURCE_DATA
    PMTS | pmts | MYUPPER | JAVA CLASS | -¦¦¥ 1
    1 row(s) returned
    SQL>
    SQL> exit
    Disconnected from CONSCLI
    c:\>msql system/*****@jdbc:polite:tomeu_pmts
    Oracle Lite MSQL Version 10.3.0.2.0
    Copyright (c) 1997, 2008, Oracle. All rights reserved.
    Connected to: Oracle Lite ORDBMS
    Database Name: PMTS (Read Write)
    Database Version: 10.3.0.2.0
    Auto Commit: off
    Driver Name: oracle.lite.poljdbc.POLJDBCDriver (OLite 4.0)
    SQL> select doUpper('fhjdjf') from dual;
    [POL-8035] no such attribute or method
    SQL> create table sp (id number(1) primary key );
    Table created
    SQL> alter table sp attach java source "MYUPPER" in '.';
    [POL-8028] error in calling a Java method
    SQL> commit;
    Commit complete
    SQL> select sp.doUpper('fhjdjf') from dual;
    [POL-8035] no such attribute or method
    Lost... :(
    Tomeu

    sorry to bother, similar like above, i tried many times on my computer to load a simple image in java application.. here's my code:
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.swing.*;
    public class View extends JFrame {
         private URL imageURL;
         private File file;
         private Image sourceImage;
         private String name, title, message;
         private int width, height;
        public static void main(String[] args) {
            System.out.println( "Hello Eros!!!" );
            View img = new View();
        public View() {
             name = "D:/shared/inputpic.gif";
             file = new File( name );
            Toolkit toolkit = Toolkit.getDefaultToolkit();
            try {
                imageURL = new URL("http://www.google.com.my/images/logo_sm.gif" );
            } catch (MalformedURLException e) {
            if ( file == null ) {
                sourceImage = Toolkit.getDefaultToolkit().getImage( name );
                System.out.println( file );
            } else {
                sourceImage = toolkit.getImage( imageURL );
                System.out.println( file );
            width = sourceImage.getWidth( this );
            height = sourceImage.getHeight( this );
            System.out.println( "Pixel = " + width + "x" + height );
            if ( width * height == 1 ) {
                title = "Greetings";  // Shown in title bar of dialog box.
                if ( file == null ) {
                    message = "Unable to load the file " + name;
                } else {
                    message = "Unable to load the link " + imageURL;
                JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
    }could anyone test this n give my the reason i couldnt even load the image

  • Help Needed in Creating Java Class and Java Stored Procedures

    Hi,
    Can anyone tell how can i create Java Class, Java Source and Java Resource in Oracle Database.
    I have seen the Documents. But i couldn't able to understand it correctly.
    I will be helpful when i get some Examples for creating a Java Class, Java Source and Stored Procedures with Java with details.
    Is that possible to Create a Java class in the oracle Database itself ?.
    Where are the files located for the existing Java Class ?..
    Help Needed Please.
    Thanks,
    Murali.v

    Hi Murali,
    Heres a thread which discussed uploading java source file instead of runnable code on to the database, which might be helpful :
    Configure deployment to a database to upload the java file instead of class
    The files for the java class you created in JDev project is located in the myworks folder in jdev, eg, <jdev_home>\jdev\mywork\Application1\Project1\src\project1
    Hope this helps,
    Sunil..

  • SQLJ and Java Stored Procedures

    Hi,
    Am very sorry, if I am taxing you too much with Java Stored Procedures!!
    However, I have struggling with it for more than 3 days or so.So please bear with me
    I am facing a peculiar problem on the subject.
    I have deployed a Java Stored Procedure using Connection name as "JDBC" through JDev.
    My client calls the Stored procedure getDept as follows:
    int deptNo = 0;
    String deptName = null,
    deptLoc = null;
    #sql {
    call sample.getDept( :out deptNo,
    :out deptName,
    :out deptLoc)
    In my project properties , in SQLJ tab, when I select "JDBC" as my connectionName, and leave the ContextName blank(i.e. DefaultContext), I get the following error :
    Error: [26] Not Found: SAMPLE.GETDEPT There is no stored procedure with this name
    When I leave the ConnectionName as blank (which I suppose means donot do online checking!!), it compiles OK.
    Howvever, it is not able to run my SQLJ file!!
    Cannot figure out why this is happening.Please help!!
    TIA
    Sandeep
    null

    Looks like Java stored procedure don't support the return of result sets to the client. Given the complexity and non-generic 'cursor ref' approach that Oracle has always implemented, I guess it is not too surprising. I suggest throwing the select into a work table and pulling the rows from there. If you are in a COM capable environment, you can use 0040 to get back a Dynaset, but be aware, it is live!
    Good luck.
    Cal

  • EM and Java stored procedures

    Could anyone answer the following questions ?
    1. Will Enterprise Manager Version 2.2 and 9.2 tune Java Stored Procedures?
    2. If not, are there plans in EM 4.0 for Enterprise Manager to tuneJava Stored Procedures?
    cheers!
    Karthik

    Hi again,
    perhaps I didn't understand exactly what you meant with "publish", AFAIK you have to expose the java class (i.e. RowCounter) by using
    CREATE OR REPLACE FUNCTION row_count (tab_name VARCHAR2) RETURN NUMBER
    AS LANGUAGE JAVA
    NAME 'RowCounter.rowCount(java.lang.String) return int';
    (BTW this works fine)
    or else you cannot access the java class you loaded on the server, and that's where my questions arose. What if I am passing an object, let's say myObject, shouldn't I use the STRUCT mapping then or something like that?
    Or, could you clarify what do you mean by publishing to SQL, I just need to access the class from jdbc, not from PL/SQL or others, but as I understand to call the class from JDBC I need to call the function or procedure that calls the class and then I could call it from PL/SQL as well...
    Thanks,
    A.

  • Jdbc and java stored procedures

    Hi all,
    I am new to Oracle Java Stored Procedures but I am interested in knowing to which extent is object passing supported.
    Can I send any kind of object to a java stored procedure? And back from the procedure? Anybody knows any good resources online about Java Stored Procedures and JDBC?
    I also saw that to pass the string back you need to specify java.lang.string, how would I do in order to pass back a user defined object, do I have to register the class in Oracle before (and if yes, how?)or is the classpath enough?
    Many thanks,
    A.

    Hi again,
    perhaps I didn't understand exactly what you meant with "publish", AFAIK you have to expose the java class (i.e. RowCounter) by using
    CREATE OR REPLACE FUNCTION row_count (tab_name VARCHAR2) RETURN NUMBER
    AS LANGUAGE JAVA
    NAME 'RowCounter.rowCount(java.lang.String) return int';
    (BTW this works fine)
    or else you cannot access the java class you loaded on the server, and that's where my questions arose. What if I am passing an object, let's say myObject, shouldn't I use the STRUCT mapping then or something like that?
    Or, could you clarify what do you mean by publishing to SQL, I just need to access the class from jdbc, not from PL/SQL or others, but as I understand to call the class from JDBC I need to call the function or procedure that calls the class and then I could call it from PL/SQL as well...
    Thanks,
    A.

  • About BC4j and java stored procedure

    Is it possible create a java stored procedure using BC4j and deploy to Oracle9iR2 VM?
    If it is possible, how about the performance compare to PL/SQL stored procedure?

    In 9.0.3.3 it will be possible again. The ability to deploy a BC4J-based, local-mode Java Stored Procedure was broken in 9.0.3 before this upcoming maintenance release.
    PL/SQL will almost surely be faster if you are talking about just doing basic DML type of operations, when compared to Java stored procedures.

  • XML and Java

    I am new in using xml in java, can any one tell me how to call XML file in java and how to read from it .
    Regards
    rajin

    Look at the XML chapters of the J2EE 1.4 Tutorial:
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    -Ian Evans

  • I'd like to load images using XML and Java - hints??

    I have a XML files that are created on a timed basis....they describe a photo and point to a dir where the photo is stored...like...
    <image>
    <user>bill</user>
    <img>photo.jpg</img>
    <img_dir>'/tmp/photos'</img_dir>
    </image>
    I'd like to write a Java program that parses the XML and loads the images, data into Oracle.
    Suggestions on Oracle tools, downloads that will help me accomplish this???
    Thanks!

    I pass a URL and then when I parse the XML I download the file from the URL.
    A.

  • XMl and Java object mapping

    I need to map java objects with XMl Node or XML Elements.
    My java objets get some attributes, for instance name,color ...
    and i need an output like:
    <OBJECT_OF_TYPE_XXX>
    <NAME>scott</NAME>
    <COLOR>red</COLOR>
    </OBJECT_OF_TYPE_XXX>
    Any idea?
    Thanks
    Maurice

    You can try JAXB which includes a compiler that generates classes based on the XML Schema for your xml structure. It also features the possibility to convert between xml and the generated objects.
    Take a look at chapter 9 and 10 at http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html

Maybe you are looking for

  • Did you know that your iPhone will burn up your USB ports?

    I have two Power Macs, Power PC G4s. After backing up my phone on both of these computers, the USB port does not work. What's up with that and how do I get the port to become usable again?

  • Music folder in external HD

    Good evening. I have a 2.16 GHz Intel iMac and I use iTunes 7.3.1 (3). I have almost 120 Gb of music so I decided to use my backup HD (external) as the source for the music folder so I can recover some space in the internal HD. So I went to itunes pr

  • Exchange roaming (or lack of) with E55

    Hi there - can anyone help with the following: E55 set up with a hosted Exchange account (via 123together.com) and a Yahoo Mail account.  The settings of the Yahoo account allow for me to choose whether it will sync email when roaming from home netwo

  • Row to column query ( Please its urgent)

    The query is SELECT WO.WORKORDERKEY, UDF1.PROJECT_MANAGER, UDF1.TEAM_MANAGER, UDF1.TEAM_LEAD, UDF1.CUSTOMER_COORDINATOR, UDF1.AVIONICS_LEAD, UDF1.INTERIOR_LEAD, UDF1.INSPECTOR, UDF1.MECHANICAL_ENGINEER, UDF1.AVIONICS_ENGINEER, UDF1.PLANNER, UDF1.PART

  • SapScript - Add field to ADDRESS - Box

    Hi, I need to add a field to the adress window in my medruck orderform. The field in adrc is called "Building". I tried to add the parameter "LOCATION" with the value 'TEST' and also with a real field, but it´s not working... Can anybody explain me,