Slow to convert Oracle 11g XMLType into Java String or Document

After retrieving a result set from an Oracle 11g database, it takes roughly 75 seconds to convert the XMLType (this is a structured XML Storage, registered with an xsd) into either a java String or Document. I'm using Java 1.6, have the xdb.jar and xmlparserv2.jar
This xsd is <100 lines and the xml document is also <100 lines.
Sample code:
oracle.xdb.XMLType xml = oracle.xdb.XMLType.createXML((oracle.sql.OPAQUE)rset.getObject("XMLDATA"));
the other way, but still took just as long:
XMLType xml = (XMLType)rset.getObject("XMLDATA");
xml.getStringVal();
or
org.w3c.dom.Document doc = xml.getDocument();
either way of the above ways takes just as long.

If I put this value into the database table, I can
see only the date. Time part is missing. Is this the
problem with java.sql.Date or Oracle datatype Date?This is not a problem, this is the defined behaviour of the Date type. RTFAPI and have a look at Timestamp, while you're at it.

Similar Messages

  • How do I get unicode characters out of an oracle.xdb.XMLType in Java?

    The subject says it all. Something that should be simple and error free. Here's the code...
    String xml = new String("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<x>\u2026</x>\n");
    XMLType xmlType = new XMLType(conn, xml);
    conn is an oci8 connection.
    How do I get the original string back out of xmlType? I've tried xmlType.getClobVal() and xmlType.getString() but these change my \u2026 to 191 (question mark). I've tried xmlType.getBlobVal(CharacterSet.UNICODE_2_CHARSET).getBytes() (and substituted CharacterSet.UNICODE_2_CHARSET with a number of different CharacterSet values), but while the unicode characters are encoded correctly the blob returned has two bytes cut off the end for every unicode character contained in the original string.
    I just need one method that actually works.
    I'm using Oracle release 11.1.0.7.0. I'd mention NLS_LANG and file.encoding, but I'm setting the PrintStream I'm using for output explicitly to UTF-8 so these shouldn't, I think, have any bearing on the question.
    Thanks for your time.
    Stryder, aka Ralph

    I created analogic test case, and executed it with DB 11.1.0.7 (Linux x86), which seems to work fine.
    Please refer to the execution procedure below:
    * I used AL32UTF8 database.
    1. Create simple test case by executing the following SQL script from SQL*Plus:
    connect / as sysdba
    create user testxml identified by testxml;
    grant connect, resource to testxml;
    connect testxml/testxml
    create table testtab (xml xmltype) ;
    insert into testtab values (xmltype('<?xml version="1.0" encoding="UTF-8"?>'||chr(10)||'<x>'||unistr('\2026')||'</x>'||chr(10)));
    -- chr(10) is a linefeed code.
    commit;
    2. Create QueryXMLType.java as follows:
    import java.sql.*;
    import oracle.sql.*;
    import oracle.jdbc.*;
    import oracle.xdb.XMLType;
    import java.util.*;
    public class QueryXMLType
         public static void main(String[] args) throws Exception, SQLException
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              OracleConnection conn = (OracleConnection) DriverManager.getConnection("jdbc:oracle:oci8:@localhost:1521:orcl", "testxml", "testxml");
              OraclePreparedStatement stmt = (OraclePreparedStatement)conn.prepareStatement("select xml from testtab");
              ResultSet rs = stmt.executeQuery();
              OracleResultSet orset = (OracleResultSet) rs;
              while (rs.next())
                   XMLType xml = XMLType.createXML(orset.getOPAQUE(1));
                   System.out.println(xml.getStringVal());
              rs.close();
              stmt.close();
    3. Compile QueryXMLType.java and execute QueryXMLType.class as follows:
    export PATH=$ORACLE_HOME/jdk/bin:$PATH
    export LD_LIBRARY_PATH=$ORACLE_HOME/lib
    export CLASSPATH=.:$ORACLE_HOME/jdbc/lib/ojdbc5.jar:$ORACLE_HOME/jlib/orai18n.jar:$ORACLE_HOME/rdbms/jlib/xdb.jar:$ORACLE_HOME/lib/xmlparserv2.jar
    javac QueryXMLType.java
    java QueryXMLType
    -> Then you will see U+2026 character (horizontal ellipsis) is properly output.
    My Java code came from "Oracle XML DB Developer's Guide 11g Release 1 (11.1) Part Number B28369-04" with some modification of:
    - Example 14-1 XMLType Java: Using JDBC to Query an XMLType Table
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb11jav.htm#i1033914
    and
    - Example 18-23 Using XQuery with JDBC
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_xquery.htm#CBAEEJDE

  • How to convert a .class file into .java file without .jad using DeJDecompil

    Hi all,
    I am using DeJDecompiler and working with swing applications.If I try to convert a .class file into .java file,it is converting into .jad file only.Fine but if I try to save that file into .java file,It is giving lot of errors in that program.When I went into that program the total style of the program is changed and TRY-CATCH block is not recognised by the dejdecompiler,hence If I try to include some methods in the existing .java file thus got,I could not do.Kindly help me.
    If I get the .java file without error then I can process the rest of the functionality.
    Thanks in advance
    With kind Regs
    Satheesh.K

    Not so urgent today then!
    http://forum.java.sun.com/thread.jsp?thread=553576&forum=31&message=2709757
    I'm still not going to help you to steal someone�s code.

  • How to convert following ABAP routine into Java

    Hi Experts
    I m new to IPC
    How to convert following ABAP routine int java
    READ TABLE XKOMV INTO XKOMV_AUX WITH KEY
                 KSCHL = 'ZCU2'
                 KPOSN = komp-kposn.
      IF SY-SUBRC EQ 0.
        MOVE XKOMV_AUX-KWERT TO XKWERT.
        MOVE XKOMV_AUX-KBETR TO XKOMV-KBETR.
            w_kwert = xkomv_aux-kwert * -1.
    DO any one has documentation on convertion of abap routines into java
    Thanks & Regards
    Sowmya

    Hi sowmya,
    download this document through this u can solveur problem
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/107adc1a-0501-0010-de8e-973e0fb4049b
    Reward if helps
    Regards
    Manohar

  • How to convert Oracle *.dmp files into something that SQL can read ?

    Is there a method I can use to convert Oracle *.dmp files into .txt files? .xls files or something??
    Any and all suggestions appreciated!
    Thanks,

    Hi
    you can't convert your .dmp file into text or xls file though you can see the contents of your .dmp file using parameter SHOW=Y in your import command. It will just show the contents of .dmp file and will not import the objects.
    Regards
    Ilyas
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by ():
    Is there a method I can use to convert Oracle *.dmp files into .txt files? .xls files or something??
    Any and all suggestions appreciated!
    Thanks,<HR></BLOCKQUOTE>
    null

  • How to Convert Oracle Apps Report into XML Publisher

    Hi
    How to Convert Oracle Apps Report into XML Publisher?
    Thanks

    In Brief :
    Re: XML Publisher
    In Details :
    http://www.oracle.com/technology/products/xml-publisher/docs/XMLEBSRep.pdf

  • Converting a Labview time into a string with Measurement Studio C++

    In my Measurement Studio-based C++ application, I'll be sent a Labview
    time in the format of a double, which I believe is seconds since 1904.
    Does Measurement Studio for Visual C++ contain a function that will
    convert that time value into a string format? I'd like to end up with
    something like "hh:mm:ss:msec". I'm basically looking for the
    equivalent of the Labview vi, "Format Time/Date String". If Measurement
    Studio doesn't provide this, is there some other (hopefully simple) way
    to do this?
    I can request that the Labview application send me time in a string
    format as well as a double; this will require several changes to the
    Labview application sending the timestamp, but if that is a simpler
    solution that's the option we'll take.
    Thanks in advance,
    Adam

    Measurement Studio does not have a function for this, but you can do
    this yourself by first converting from LV epoch (1/1/1904) to Unix
    epoch(1/1/1970) and then using c runtime time functions
    UNIXEpochOffset is the difference between the 2 epochs at GMT. To
    convert to a UNIX system clock value, just subtract the sum of this
    number and your time zone offset in seconds
    lvTime is the value returned by LV timestamp
    #define  UNIXEpochOffset 2082844800
    int _tmain(int argc, _TCHAR* argv[])
        __int64 lvTime = 3214396284; //10:48:13.173 AM 11/9/2005
        //GMT offset for Central Time is -6 (3600 seconds). You will need to account for daylight savings time.
        int offset = -3600;
        time_t unixTime = lvTime - UNIXEpochOffset - offset;  
        struct tm *newtime = localtime(&unixTime);
        printf(asctime( newtime )); //prints out the time in a string format.
        return 0;
    Bilal Durrani
    NI

  • Slow connection to oracle 11g R2 database if no Internet connection

    Hi all,
    I've read some similar topics, but could not find a solution for my problem. I'm running Windows 7 Enterprise with a VMWare (Player) with a virtual Linux image on my machine (centos 5.4) in NAT connection mode. On the virtual machine I have installed an Oracle 11g R2 database. As long as I'm connected to Wi-FI or I'm plugged into my LAN network, I can access the database and run applications without a problem. But if I don't have an Internet connection, it's almost impossible to connect to the database or use certain applications.
    Thanks in advance for your help !
    Gianni
    Below the settings on my virtual machine:
    TNSNAMES.ora
    LISTENER_ORCL =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    ORCL =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dmserver)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = orcl)
    LISTENER.ora
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = dmserver)(PORT = 1521))
    ADR_BASE_LISTENER = /usr/local/software/oracle
    I also have a local loopback adaptor installed (below some info from my ifconfig):
    lo Link encap:Local Loopback
    inet addr:127.0.0.1 Mask:255.0.0.0
    inet6 addr: ::1/128 Scope:Host
    UP LOOPBACK RUNNING MTU:16436 Metric:1
    RX packets:9396 errors:0 dropped:0 overruns:0 frame:0
    TX packets:9396 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:0
    RX bytes:3047584 (2.9 MiB) TX bytes:3047584 (2.9 MiB)
    Edited by: 939190 on Jun 7, 2012 2:04 AM

    Solved it by commenting out my nameserver in resolv.conf and adding my hostname explicitely to the etc/hosts file in Linux. A good thread on this is: Oracle connection extremely slow(Oracle 11G on Linux RHEL4)

  • Import oracle 11g database into oracle 10g Server -

    Hi guys,
    We have a oracle db running on Oracle 11g. Now, we would like to export from oracle 11g into Oracle 10g XE for important demo. Is it possible??
    When i try to import into Oracle 10g XE, the following Error msg appears :
    IMP-00010: Not a valid export file, header failed verification
    Pls help soonest possible...
    tx
    Rama

    A BIG thank you to both of you, Managed to import succesfully. appreciate your help.
    Just for others who would be using this forum.
    Steps involved
    1. connect with Oracle 10g Export utility to the source db.
    2. export the db from source to target server
    3. create DDL & schema of the source db.... ( i used toad dba )
    4. run the DDL & schema of the target db (oracle 10g) .. ( i used toad dba )
    5. import the dump to target server.
    6. done...
    thanks.

  • How to add elements into java string array?

    I open a file and want to put the contents in a string array. I tried as below.
    String[] names;
    s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
    while (s.hasNext()) {
                    String item = s.next();
                    item.trim();
                    email = item;
                    names = email;
                }But I know that this is a wrong way of adding elements into my string array names []. How do I do it? Thanks.

    Actually you cannot increase the size of a String array. But you can create a temp array with the lengt = lengthofarray+1 and use arraycopy method to copy all elements to new array, then you can assign the value of string at the end of the temp array
    I would use this one:
    String [] sArray = null;
    s = new Scanner(new BufferedReader(new FileReader("outfile.txt")));
    while (s.hasNext()) {
        String item = s.next();
        item.trim();
        email = item;
        sArray = addToStringArray(sArray, email);
    * Method for increasing the size of a String Array with the given string.
    * Given string will be added at the end of the String array.
    * @param sArray String array to be increased. If null, an array will be returned with one element: String s
    * @param s String to be added to the end of the array. If null, sArray will be returned.(No change)
    * @return sArray increased with String s
    public String[] addToStringArray (String[] sArray, String s){
         if (sArray == null){
              if (s!= null){
                   String[] temp = {s};
                   return temp;
              }else{
                   return null;
         }else{
              if (s!= null){
                   String[] temp = new String[sArray.length+1];
                   System.arraycopy(sArray,0,temp,0,sArray.length);
                   temp[temp.length-1] = s;
                   return temp;
              }else{
                   return sArray;
    }Edited by: mimdalli on May 4, 2009 8:22 AM
    Edited by: mimdalli on May 4, 2009 8:26 AM
    Edited by: mimdalli on May 4, 2009 8:27 AM

  • How to convert pl/sql code into java/j2ee

    Hi,
    We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
    And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
    Does any body has any idea:
    a) How to convert from pl/sql > java ?
    b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
    thanks, sangita

    these pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
    >
    Does any body has any idea:Refactor.
    I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place.

  • Converting a text file into a String

    I need to convert a text file (in whatever format, in my case it would be xml and xsl files) in a String.
    I made this methods:
    public static String createStringFromFile(File f) {
            StringBuffer buf = new StringBuffer();
            try {
                FileInputStream fInp = new FileInputStream(f);
                byte[] byteArray = new byte[fInp.available()];
                int bLetti = fInp.read(byteArray);  
                if (bLetti == fInp.available()) {
                    for (int i=0; i<fInp.available(); i++)
                        buf.append(Byte.toString(byteArray));
    else
    throw (new IOException("Errore nella lettura del file"));
    fInp.close();
    } catch (Exception e) {
    ErrorManager.getError(e);
    return (buf.toString());
    public static String createStringFromFile(String fileName) {
    StringBuffer buf = new StringBuffer();
    try {
    FileInputStream fInp = new FileInputStream(fileName);
    byte[] byteArray = new byte[fInp.available()];
    int bLetti = fInp.read(byteArray);
    if (bLetti == fInp.available()) {
    for (int i=0; i<fInp.available(); i++)
    buf.append(Byte.toString(byteArray[i]));
    else
    throw (new IOException("Errore nella lettura del file"));
    fInp.close();
    } catch (Exception e) {
    ErrorManager.getError(e);
    return (buf.toString());
    There are no compilation or runtime errors, but the result string is empty. Not null, empty. What should I do? :)

    Do you really want to use bytes and so on when java does it all for you?
    Here's how I did it, hope it's useful.
    public String getFileAsString(String fileName){
         StringBuffer buffer = new StringBuffer();
         try{
         BufferedReader bRead = new BufferedReader(new FileReader(new File(fileName)));
         String str = "";
         while( (str = bRead.readLine()) != null ){
              buffer.append(str);
         }//end while
         bRead.close();
         }catch(Exception e){
         System.err.println("in getFileAsString(): " + e.toString());
         }//end try
         return buffer.toString();
    }//end getAsString()

  • How can I convert a U32 array into binary string?

    Hi
    I would like to find an efficient way to convert an array of 8192 U32 into a single binary string!!!
    the solution below  last 550 ms on an RT target to convert 8192 U32.
    The same code running on Labview (not RT) last 100ms. I don't understand why there is such a difference.
    I've tryed to replace the inner loop and convert by a format string whith U32 on entry and %032b as parameter but it lasted same time.
    Thanks a lot

    Your picture of your code didn't come through. You can't link to a picture that's on your computer, as a server on the internet cannot access your computer to display the picture for others to see. You have to upload the picture as an attachment. Then, if you want to actually display the picture in the message you have to edit your post, insert a picture, and when it asks for the URL you enter the URL of the picture. You can get the URL when viewing the message, as the link is within the message itself.
    As for your question, can you just use the TypeCast function?

  • Oracle 11g: Split a line string in a set of two-points-line

    Hi,
    I have n Oracle RDBMS 11gR2 EE database.
    I have a single 2-D linestring with about 100 points.
    Does someone know a technic to "split" that line in an adajacent set of lines composed of 2 points only?
    Thanks by advance for any tips.
    Kind Regards

    Hi
    As John explained, that book is extremely recommended, well written and comes with a lot of examples.
    In addition, a simple SQL example I used 6 years ago:
    select id,
           sdo_geometry(2002, NULL, NULL,
               SDO_ELEM_INFO_ARRAY(1,2,1),
               SDO_ORDINATE_ARRAY(startx, starty, endx, endy)
    from
        select
             startp.strtcnt_id, startp.x startx, startp.y starty, startp.v_id, endp.x endx, endp.y endy, endp.v_id
        from
            select strtcnt_id, t.id v_id, t.x, t.y
            from YOUR_TABLE_NAME s, table(sdo_util.getvertices(geometry)) t
            ) startp
            select strtcnt_id, t.id v_id, t.x, t.y
            from YOUR_TABLE_NAME s, table(sdo_util.getvertices(geometry)) t
            ) endp
        where startp.id = endp.id
        and startp.v_id = endp.v_id - 1
    The inner selects can be made simpler and more performant I believe using the with clause, but it should work.
    Luc

  • Convert arrays of picture into JPEG string

    Hiya, 
    I have constructed a procedure to carry out some intensity analysis for my experiment.  I have chosen to use snap instead of grab, as I only need to acquire and analyse images in every 2-30 secs (low level acquisition).  I have created a time cycle for each snap shot.  However, I could not save my images, as every 30sec the process will stop and the error will occur.  At the moment, I have connected the picutre to an AVI create.vi, everytime I run the vi, an error occurs. 
    I would like to save all my images into the same directory without using grab and without LABVIEW asking me the file name every time I want to save an image.  I would be the most appreciated if someone could help me with the problem please??
    Attachments:
    Nearlyfinishcam15.vi ‏263 KB

    hello,
    Maybe this is not what you want. But if you wanna a way  of saving your snaps to a directory you can do a simple thing as simple as I show you in the pic attached. You just have to but that inside a case that's true in the period that you want. And then you connect something to the "pic number" control in order to give different names for every snap.
    I don't have time to analyze you .vi. But I think that it's very complicated. And worst than that it's that maybe not very well programmed and you might have some problems. You have several parts of the code that you don't garanty Dataflow. Pay attention to that.
    This it's only a few ideas.
    Best regards,
    Software developer
    www.mcm-electronics.com
    PS: Don't forget to rate a good anwser ; )
    Currently using Labview 2011
    PORTUGAL
    Attachments:
    save pics.jpg ‏28 KB

Maybe you are looking for

  • FPM Form Scripting - How to call a web dynpro application as pop up

    Hi All, I want to call a web dynpro application as a pop up from FPM form scripting. Like click on button -Maintain Approval Routing in a FPM form i want to open a web dynpro pop up.. Thanks In Advance.

  • Need to read source file without deleting it - Sender SFTP adapter

    Dear friends, The data from the source file needs to be read by PI on a daily basis. The file should not be deleted. Vendor  updates the file on a daily basis with file name DataFeed.xml How to acheive this in Sender SFTP adapter ? Kindly guide me Re

  • Adobe LiveCycle Designer

    Hi guys, i having problem preview my form in Designer. Im using version 8.0. Should i upgrade to latest version and what is the latest version? From internet, it show up Adobe LiveCycle Designer ES2. I'm not sure is the one?

  • Using  Weblogic app environment in Visual Age

    Hi,           I am using Weblogic as my test environment in Visual Age. I am getting alone           well with servlet and beans. But I am having enormous problem with jsp. Does           any body know how to configure weblogic test environment in Vi

  • Custom Duty & Assessable Value

    Hi Experts, I cant understand the concept 1) What is the use of Custom Duty 2) What is the use of Assessable Value How to handle both in SAP B1? regards anand