GetXMLString() problem in OracleXMLQuery

Hi
I write xml from oracletables with Oracle sqlxml utility. It works fine but when I have a result with a large amount of data the getXMLString() crashes. The error I get is: java.lang.OutOfMemoryError
at java.lang.StringBuffer.expandCapacity(StringBuffer.java:182)
public void writeXml() {
Connection conn = null;
ResultSet rset = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(jdbcConn);
Statement stmt = conn.createStatement();
rset = stmt.executeQuery(sql);
catch (ClassNotFoundException e ){
System.err.println(e);
catch(SQLException e2) {
System.err.println(e2);
OracleXMLQuery qry = new OracleXMLQuery(conn,rset);
// HERE I HAVE PROBLEM WITH String
System.out.println(qry.getXMLString());
Any tip?
/Christer

Have you tried rebooting the tablet? How often do you get those errors? Is it only after you use the camera? Does the camera work?
- Peter

Similar Messages

  • GetXMLString

    Hi.
    I am receiving an error when I call getXMLString() to retrieve the results of a query as an XML document in string format.
    I don't get any errors at compile time. I made sure that the rset contains rows. We are using XSU 1.1.1.0.
    Any input is appreciated.
    The code looks like this:
    ResultSet rset = issue query...
    OracleXMLQuery qry = new OracleXMLQuery(conn, rset);
    String theString = qry.getXMLString();
    ---------------------------

    Problem solved.

  • XML SQL Utility problem

    Hi,
    I'm trying to use the XML SQL Utility against a 8.0.5 database.
    I coded a basic query against the SCOTT.EMP table.
    I've instantiated an OracleXMLQuery object using both types of
    constructors (i.e. Connection + ResultSet or query String). In
    both cases the resulting XML String contains:
    <?xml version="1.0"?>
    <ERROR>Closed Resultset</ERROR>
    I know that my Connection and ResultSet objects are valid because
    I examined the ResultSet contents using standard JDBC getXXX
    methods for the same Connection and query. I am establishing my
    Connection using the thin driver. Is this the problem? Can you
    also elaborate on the Oracle specific requirements for this API?
    For example, will the API work for Connection and ResultSet
    objects against non-Oracle databases? Thanks.
    Fred
    null

    Hi Fred,
    The closed ResultSet problem would occur when u are trying to
    re-use the same object,
    e.g.
    OracleXMLQuery oxq = new OracleXMLQuery(conn,resultsetobject);
    // get the string..
    String xmlString = oxq.getXMLString();
    By default OracleXMLQuery closes the ResultSet after
    completion. so if u use.
    xmlString = oxq.getXMLString();
    again, you will get this error.
    To overcome this there is a call called keepCursorAlive() which
    takes in a boolean value. So call that function on oxq before
    getting the first string and everything will be all right.
    Currently we also close the resultSet given by the user. This
    is a bug (we should only close our internal resultset) and we
    will fix it in the next drop. Also we will make this error
    message much more legible!
    Regarding working against other databases, we use Oracle
    specific stuff currently in case of object features such as
    ADTs, REFs and collections and LOBs. For regular relational data
    such as number, varchar etc.., we don't do anything special.
    So for plain relational data this should work against
    ResultSet and Connection objects created from other databases.
    But to be honest, we haven't tested that out. So if you do
    indeed run into any problems with other databases, please let us
    know and we will try to fix it.
    Thx
    Murali
    Fred Criscuolo (guest) wrote:
    : Hi,
    : I'm trying to use the XML SQL Utility against a 8.0.5 database.
    : I coded a basic query against the SCOTT.EMP table.
    : I've instantiated an OracleXMLQuery object using both types of
    : constructors (i.e. Connection + ResultSet or query String).
    In
    : both cases the resulting XML String contains:
    : <?xml version="1.0"?>
    : <ERROR>Closed Resultset</ERROR>
    : I know that my Connection and ResultSet objects are valid
    because
    : I examined the ResultSet contents using standard JDBC getXXX
    : methods for the same Connection and query. I am establishing
    my
    : Connection using the thin driver. Is this the problem? Can
    you
    : also elaborate on the Oracle specific requirements for this
    API?
    : For example, will the API work for Connection and ResultSet
    : objects against non-Oracle databases? Thanks.
    : Fred
    null

  • It is possible to convert String to XMLDocument?

    I use XML SQL Utility to generate an XML document from the results of a query. I want to apply XSLT on this xml document.
    The problem is that XSU generates the document in String format. Or I use XSLProcessor.processXSL, and this method needs to parameters stylesheet and XMLDocument.
    So, my question is :It is possible to convert String to XMLDocument?
    Thanks.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Use getXMLDOM() instead of getXMLString() on the OracleXMLQuery object. This returns you a DOM representation instead of a string, avoiding parsing.<HR></BLOCKQUOTE>
    Hi
    I'm reading about how " generate an XML document from the results of a query" i exactly want to do this but i need to create the XML file not only generate it. How I "create" the XML file?. Because, I need to manipulate later my XML file.
    Thanks for any help.
    null

  • OracleXMLQuery and OracleXMLSave  Problem

    I have tow problems in my Java/oracle Application :
    1)
    I am using OracleXMLQuery to extract data from a data base, the problem is when the table is empty i get an empty output file.
    Is there a method to get the header of the table (the manes of colomns ) in the output file (.xml) even if the table is empty ?
    2)
    the second problem is in importing the .xml file to a table in the data base :
    I import a lot of files some of them are sucessfully imported and others skip some lines.
    so I get some rows missed in the data base.
    (I notice that the file is well opened in Xml spy and i can see all my data in it.)
    Can someone help me ?
    Thank you

    Found the solution :
    successfully connected to datacase but cannot retrieve olap metadata

  • Oracle.xml.sql.OracleXMLSQLException when using OracleXMLQuery getXMLDOM()

    Hi!
    I am trying to reuse a code in JDeveloper to get XML from a query. I have copied the code from a method and created a new method with the copied code and changed it. The problem is that when I run the old code I now get following error:
    Ett oförväntat fel har inträffat: Application: FND, Message Name: FND_GENERIC_MESSAGE.
    Tokens: MESSAGE = oracle.xml.sql.OracleXMLSQLException: Det här objektet har stängts.
    Vill du inte att objektet ska stängas automatiskt mellan anropen kan du granska metoden 'keepObjectOpen()'.;
    This means in english something like:
    An unexpected error accoured: Application: FND, Message Name: FND_GENERIC_MESSAGE = oracle.xml.sql.OracleXMLSQLException: This object is closed. If you don't want the object to close automatically between calls you can check method 'keepObjectOpen()';
    the code I'm running is:
    public String punchoutSomething()
    throws Exception
    StringBuffer sqlForXml =new StringBuffer("select pv.*"
    +", cursor(select * from XXPOS_PUNCHOUT_TABLE2 c where c.vendor_id=pv.vendor_id) as contacts"
    +" from XXPOS_PUNCHOUT_TABLE1 pv where vendor_id in (");
    // add all ids
    SuppSummVOImpl vendorView = getSuppSummVO();
    Row row;
    int punchoutCnt=0;
    // vendorView.reset();
    Row[] selectedRows = vendorView.getFilteredRows("SelectStatus","Y");
    for(int i=0;i<selectedRows.length;i++)
    if(punchoutCnt>0)
    sqlForXml.append(",");
    sqlForXml.append(((Number)selectedRows.getAttribute("VendorId")).toString());
    punchoutCnt++;
    if(punchoutCnt==0)
    sqlForXml.append("-1"); // make sql valid, will not return rows
    sqlForXml.append(")");
    // System.out.println(sqlForXml); // DEBUG
    OADBTransaction tx = (OADBTransaction)getOADBTransaction();
    OracleXMLQuery xq = new OracleXMLQuery( tx.getJdbcConnection()
    , sqlForXml.toString()
    xq.setRaiseException(true); // in case of error raise an exception (default
    // is to generate an error document
    xq.setEncoding("UTF-8"); // not necessary?
    xq.useLowerCaseTagNames();
    xq.setRowsetTag("vendors");
    xq.setRowTag("vendors_row");
    //System.out.println(xq.getXMLString()); // DEBUG
    XMLDocument suppl = (XMLDocument)xq.getXMLDOM();
    XSLProcessor xslt = new XSLProcessor();
    InputStream sheetStream = this.getClass().getResourceAsStream("mystylesheet.xsl");
    if(sheetStream==null)
    throw new Exception("Could not load stylesheet");
    XSLStylesheet sheet = xslt.newXSLStylesheet(
    sheetStream
    StringWriter serialize = new StringWriter();
    xslt.processXSL(sheet,suppl,new PrintWriter(serialize));
    String returnXML = serialize.getBuffer().toString();
    // System.out.println("X:"+returnXML); // DEBUG
    sheetStream.close();
    return returnXML;
    ===================
    i've copied the same code into another method and only changed the sql-statment to be used and the stylesheet to use to transform the xml. Is something wrong with that?
    Another question: if the xsl refers to a xsd but wihtout any path where should it be?
    Thanks for the help,
    Patricia

    Actually, having looked at Metalink, seems that although this message may be accurate and correct,
    it has been 'introduced' as part of the 9i JDBC driver.
    So, I used the 8i JDBC driver I happened to have instead and that worked fine.

  • Using OracleXMLQuery with Oracle 9i

    Sample code example -
    OracleXMLQuery xmlData = new OracleXMLQuery(conn, sqlQuery);
    String xmlString = xmlData.getXMLString();
    PrintWriter xmlFile.print(xmlString);
    I am able to connect to the database and print out the XML file. I'm querying an object that has a table embedded and everything was printing out okay in 8i, but now it 9i the string data fields in the embedded table are printing out in hexadecimal format. I've been to Sun's web site and in the forum discussions other developers are having the same problems without any know solution.
    Has anyone here came up with a fix?

    I thought that imp, with full=Y option will import everything into this empty dB, no matter There are not any schemes and users that were in the original dB...
    Your understanding is 100% correct, but the question is, how did you take the export? Because, if you have taken full export, you haven't hit this problem. Could you tell us how did you made export?

  • Invalid cursor problem

    Steve,
    Were you ever able to look at this item? In the meantime, my work around was to do a separate xsql query for each sub-query(cursor) and then append nodes in my DOM as I went along. But, I would like to help this tool be better. I think I have determined that if one of the sub-select/sub-cursor queries doesn't return anything, I get the "invalid cursor" error. Does that make sense to you? I think that if a the result should still be a blank node
    ( </NODE> ). What do you think?
    thanks,
    chad.
    -----Original Message-----
    From: Chad Small
    Sent: Friday, September 22, 2000 9:31 AM
    To: 'Steve Muench'
    Subject: RE: LONG data type and subsequent CURSOR's question/problem
    I attached two files:
    1. file with sql script - you'll have to change the schema.
    2. file with code. Two sections
    a. 1st with jdbc result set code
    b. 2nd with OracleXMLQuery
    I comment out one or the other code section to run one or the other.
    If you need any other information, please let me know.
    thanks,
    chad.
    -----Original Message-----
    From: Steve Muench [mailto:[email protected]]
    Sent: Thursday, September 21, 2000 4:14 PM
    To: Chad Small
    Subject: Re: LONG data type and subsequent CURSOR's question/problem
    Is it possible to send me CREATE TABLE script with one row
    of sample data inserted that reproduces the problem?
    Thanks.
    Steve Muench, Lead XML Evangelist & Consulting Product Manager
    BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    Author "Building Oracle XML Applications", O'Reilly http://www.oreilly.com/catalog/orxmlapp/
    ----- Original Message -----
    From: "Chad Small" <[email protected]>
    To: "'Steve Muench'" <[email protected]>
    Sent: Thursday, September 21, 2000 3:56 PM
    Subject: RE: LONG data type and subsequent CURSOR's question/problem
    |
    | Using the same query string on both programs:
    |
    | String xsqlString =
    | "SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | hwp.body, " +
    | "CURSOR( SELECT hws.name as section_name " +
    | "FROM health.section hws " +
    | "WHERE hwp.section_id = hws.section_id) as section " +
    | "FROM health.publish_document hwp " +
    | "WHERE hwp.publish_document_id IN (13729, 1033, 11695)";
    | ____________________________________________________________________________
    | ______
    | This works - simple JDBC program :
    |
    | PreparedStatement stmt = conn.prepareStatement(xsqlString);
    | ResultSet rs = stmt.executeQuery();
    |
    | int n=1;
    | while( rs.next() ) {
    | System.out.println(n+": publish_document_id =
    | "+rs.getInt("publish_document_id"));
    | System.out.println(n+": topic_id = "+rs.getInt("topic_id"));
    | System.out.println(n+": section_id = "+rs.getInt("section_id"));
    | n++;
    | }
    | rs.close();
    | stmt.close();
    | conn.close();
    | ____________________________________________________________________________
    | ______
    | This does not work - simple OracleXMLQuery:
    |
    | OracleXMLQuery qry = new OracleXMLQuery(conn, xsqlString);
    | System.out.println("after\n");
    | // structure the generated XML document
    | qry.setMaxRows(1); // set the maximum number of rows to be returned
    | qry.setStyleSheet("file:D:\\xsql\\bin\\healthwise.xsl"); // sets the
    | stylesheet
    |
    | // get the XML document in string format
    | String xmlString = qry.getXMLString();
    |
    | // print out the XML document
    | System.out.println(" OUTPUT IS:\n"+xmlString);
    | conn.close();
    | ____________________________________________________________________________
    | _______
    | -> get this:
    |
    | OUTPUT IS:
    | <?xml version = '1.0'?>
    | <ERROR>oracle.xml.sql.OracleXMLSQLException: Stream has already been
    | closed</ERROR>
    |
    |
    | java.sql.SQLException: ORA-01001: invalid cursor
    |
    | at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    | at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    | at oracle.jdbc.ttc7.Oclose.receive(Oclose.java:126)
    | at oracle.jdbc.ttc7.TTC7Pr otocol.close(TTC7Protocol.java:493)
    | at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:467)
    | at
    | oracle.jdbc.driver.OracleConnection.close_statements(OracleConnection.java:1
    | 141)
    | at oracle.jdbc.driver.OracleConnection.close(OracleConnection.java:537)
    | at com.healthecare.search.apelon.xmlquerydb.main(xmlquerydb.java:116)
    | at symantec.tools.debug.Agent.runMain(Native Method)
    | at symantec.tools.debug.MainThread.run(Agent.java:48)
    |
    |
    | Please advise.
    |
    | thanks,
    | chad.
    | -----Original Message-----
    | From: Steve Muench [mailto:[email protected]]
    | Sent: Thursday, September 21, 2000 1:46 PM
    | To: Chad Small
    | Subject: Re: LONG data type and subsequent CURSOR's question/problem
    |
    |
    | Are you able to test the query that does cause the
    | problem with:
    |
    | -> The command-line XSU utility
    | -> A simple JDBC program that creates a prepared statement
    | with this query and executes it to produce a result set
    |
    | I want to know if the problem is in JDBC or XSU.
    |
    | ______________________________________________________________
    | Steve Muench, Lead XML Evangelist & Consulting Product Manager
    | BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    | Author "Building Oracle XML Applications", O'Reilly
    | http://www.oreilly.com/catalog/orxmlapp/
    |
    | ----- Original Message -----
    | From: "Chad Small" <[email protected]>
    | To: "'Steve Muench'" <[email protected]>
    | Sent: Thursday, September 21, 2000 1:09 PM
    | Subject: RE: LONG data type and subsequent CURSOR's question/problem
    |
    |
    | | The problem does NOT occur in (1) -simple query.
    | | And yes, the problem does occur in (2) - in combination with CURSOR.
    | |
    | | thanks,
    | | chad.
    | |
    | | -----Original Message-----
    | | From: Steve Muench [mailto:[email protected]]
    | | Sent: Thursday, September 21, 2000 11:44 AM
    | | To: Chad Small
    | | Subject: Re: LONG data type and subsequent CURSOR's question/problem
    | |
    | |
    | | Trying to isolate the problem a little...
    | |
    | | (1) Does the problem occur if you do a simple query like:
    | |
    | | SELECT body FROM table
    | |
    | | with just the LONG column?
    | |
    | | (2) Or does it only happen in combination with CURSOR() ?
    | |
    | | ______________________________________________________________
    | | Steve Muench, Lead XML Evangelist & Consulting Product Manager
    | | BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
    | | Author "Building Oracle XML Applications", O'Reilly
    | | http://www.oreilly.com/catalog/orxmlapp/
    | |
    | | ----- Original Message -----
    | | From: "Chad Small" <[email protected]>
    | | To: <[email protected]>
    | | Sent: Thursday, September 21, 2000 10:24 AM
    | | Subject: LONG data type and subsequent CURSOR's question/problem
    | |
    | |
    | | | Hello Steve,
    | | |
    | | | First I want to thank-you for all of the support you put into Oracle's
    | XML
    | | | board. I just ordered your book from Fatbrain and it's on back order!
    | I
    | | | tried asking my question on the board and didn't have any luck getting
    | any
    | | | responses - maybe people didn't understand my question. I'm desperate
    | for
    | | | this to work and really need some guidance.
    | | |
    | | | I'm using the command line to extract data from tables to XML
    | | | (.bin\xsql\bin\xsql healthwise.xsql chad.xml). Everything works
    | | wonderfully
    | | | until I add a LONG data type to the mix. Here is my xsql before the
    | LONG:
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | | | CURSOR( SELECT hws.name as section_name
    | | | FROM health.section hws
    | | | WHERE hwp.section_id = hws.section_id) as section,
    | | | CURSOR( SELECT hwk.name as keyword_name
    | | | FRO M health.keyword hwk, health.map_keyword_object
    | | | hwmko, health.object hwo
    | | | WHERE (hwp.publish_document_id =
    | | | hwo.publish_document_id) and
    | | | (hwo.object_id = hwmko.object_id) and
    | | | (hwmko.keyword_id = hwk.keyword_id) ) as keywords,
    | | | CURSOR( SELECT hwt.name as topic_name,
    | | | CURSOR( SELECT hwts.name as topic_synonym_name
    | | | FROM health.topic_synonym hwts
    | | | WHERE hwt.topic_id = hwts.topic_id) as
    | | | topic_synonyms,
    | | | CURSOR( SELECT hwc.name as catagory_name
    | | | FROM health.category hwc,
    | | health.map_category_topic
    | | | hwmct
    | | | WHERE (hwt.topic_id = hwmct.topic_id) and
    | | | (hwmct.category_id = hwc.category_id) ) as catagories
    | | | FROM health.topic hwt
    | | | WHERE hwp.topic_id = hwt.topic_id) as topic
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.publish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | I'm using this in combination with a XSLT and get this output -
    | Beautiful!
    | | -
    | | | just what I want, less my LONG body field :
    | | |
    | | | <?xml version="1.0" encoding="UTF-8"?>
    | | | <CONTENT>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=10744&#38;item=7</URL>
    | | | <TITLE>Graft versus Host Disease</TITLE>
    | | | <RANK1>
    | | | <RANK1_DSCR>GVHD</RANK1_DSCR>
    | | | </RANK1>
    | | | <RANK2/>
    | | | <RANK3>
    | | | <RANK3_DSCR>Rare Disorders</RANK3_DSCR>
    | | | </RANK3>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=910&#38;item=4</URL>
    | | | <TITLE>Hypnosis</TITLE>
    | | | <RANK1/>
    | | | <RANK2>
    | | | <RANK2_DSCR>Hypnotherapy</RANK2_DSCR>
    | | | </RANK2>
    | | | <RANK3/>
    | | |
    | | |
    | |
    | <URL>http://healthecare140:7601/medical/medicalDocument.jsp?page=medical&#38
    | | | ;topic=12344&#38;item=9</URL>
    | | | <TITLE>Low Back Problems -- Computerized axial tomography (CAT scan,
    | | | CT scan)</TITLE>
    | | | <RANK1>
    | | | <RANK1_DSCR>CT scan (computerized tomography),
    | | | back</RANK1_DSCR>
    | | | <RANK1_DSCR>CT scan, back</RANK1_DSCR>
    | | | <RANK1_DSCR>Back, CT scan of</RANK1_DSCR>
    | | | <RANK1_DSCR>Computed axial tomography (CAT) scan,
    | | | back</RANK1_DSCR>
    | | | </RANK1>
    | | | <RANK2/>
    | | | <RANK3/>
    | | | </CONTENT>
    | | |
    | | |
    | | | BUT, as soon as I add the LONG body field into the query (in BOLD):
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id,
    | hwp.body,
    | | | <--------- hwp.body is the LONG
    | | | CURSOR( SELECT hws.name as section_name
    | | | FROM health.section hws
    | | | WHERE hwp.section_id = hws.section_id) as section,
    | | | CURSOR( SELECT hwk.name as keyword_name
    | | | FROM health.keyword hwk, health.map_keyword_object
    | | | hwmko, health.object hwo
    | | | WHERE (hwp.publish_document_id =
    | | | hwo.publish_document_id) and
    | | | (hwo.object_id = hwmko.object_id) and
    | | | (hwmko.keyword_id = hwk.keyword_id) ) as keywords,
    | | | CURSOR( SELECT hwt.name as topic_name,
    | | | CURSOR( SELECT hwts.name as topic_synonym_name
    | | | FROM health.topic_synonym hwts
    | | | WHERE hwt.topic_id = hwts.topic_id) as
    | | | topic_synonyms,
    | | | CURSOR( SELECT hwc.name as catagory_name
    | | | FROM health.category hwc,
    | | health.map_category_topic
    | | | hwmct
    | | | WHERE (hwt.topic_id = hwmct.topic_id) and
    | | | (hwmct.category_id = hwc.category_id) ) as catagories
    | | | FROM health.topic hwt
    | | | WHERE hwp.topic_id = hwt.topic_id) as topic, hwp.body
    | | | <---------------- I tried it here too
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.pu blish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | I get this error:
    | | | oracle.xml.sql.OracleXMLSQLException: Stream has already been closed
    | | |
    | | |
    | | | However, this works:
    | | |
    | | | <?xml version="1.0"?>
    | | | <!-- healthwise_xslt.xsql -->
    | | | <xsql:query
    | | | xmlns:xsql="urn:oracle-xsql"
    | | | connection="healthwise_dev2"
    | | | max-rows="22050" >
    | | |
    | | | SELECT hwp.publish_document_id, hwp.topic_id, hwp.section_id, hwp.body
    | | | <--------- hwp.body is the LONG
    | | | FROM health.publish_document hwp
    | | | WHERE hwp.publish_document_id IN (13729, 1033, 11695)
    | | | </xsql:query>
    | | |
    | | |
    | | | Do I have to pull this out into code and stream the long into a string
    | and
    | | | build a DOM and then go to XML from that? Or something along those
    | lines?
    | | | And if this is the case, can you point me to some sample code.
    | | | I don't have the option of changing the LONG to something that doesn't
    | | have
    | | | to be streamed as suggested in this
    | | |
    | |
    | doc(http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/basic4.htm).
    | | |
    | | |
    | | | If we can come to a conclusion on this, I will be the xsql-long
    | evangelist
    | | | on the board!
    | | |
    | | | Thank-you for you time,
    | | | chad. <[email protected]>
    | | |
    | | |
    | |
    |
    null

    Just wanted to post Steve's response to this question, in case others have problems with LONG data types and CURSORS in their .xsql queries (thanks Steve!):
    I can reproduce the problem with your testcase.
    I've filed Bug Number 1472008.
    You can workaround the problem by using CLOB
    instead of LONG in your table.
    You can use to TO_LOB() function in a CREATE TABLE...AS SELECT...
    or in an INSERT INTO TABLE...SELECT... to easily
    convert existing LONG content into CLOBs.
    null

  • Oracle XSU: oracle.xml.sql.query.OracleXMLQuery is not recognized

    Hi, there!
    I've got a problem when tryed to use Oracle XSU (xml-sql utility to generate xml). My simple java application works fine using XSU. But when I created session stateless bean I've got an EJBException regarding this
    line:
    oracle.xml.sql.query.OracleXMLQuery qry = new oracle.xml.sql.query.OracleXMLQuery(conn, commandSQLStatement);
    It doesn't recognize OracleXMLQuery class as I've got in dump. So my classpath includes original location of that utility and Oracle parser.
    I really appreciate for any help.
    Thanks.
    strXML = qry.getXMLString();

    Patricia,
    Did you go through the link
    Re: XML SQL Utility
    You have to put xsu12.jar in the lib directory of the jdev.
    xsu12.jar is in the lib directory of the XDK installation.
    You can download XDK from
    http://www.oracle.com/technology/tech/xml/xdk/software/prod/xdk_java.html
    Just download the XDK kit, get the xsu12.jar from the lib directory and put in the lib directory of the jdev.
    -- Arvind

  • Pls help...No class found for Datum in OracleXMLquery

    Hello,
    I tried to generate a simple XML document using OracleXMLQuery. But it gives me the following error.
    ==========================
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/sql/Datum
    at oracle.xml.sql.query.OracleXMLQuery.<init>(OracleXMLQuery.java:127)
    at testJDBC.main(testJDBC.java:43)
    ==========================
    I was using JDBC.ODBC driver. When I took out the following lines from my code, my code works and returns some information in that table, but of course not XML document.
    ==========================
    OracleXMLQuery qry = new OracleXMLQuery(con,result);
    // get the XML document is the string format
    String xmlString = qry.getXMLString();
    // print out the result
    System.out.println(" OUPUT IS:\n"+xmlString);
    ===========================
    What is wrong with the above paragraph?
    Thank you very much for your help!
    -Steve
    The complete code is attached as follows:
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.math.*;
    import oracle.xml.sql.query.*;
    public class testJDBC{
    public static void main(String args[]){
    String URL = "jdbc dbc:steveUUdialTest";
    String username = "sa";
    String password = "lamb";
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    } catch (Exception e1) {
    System.out.println("Failed to load JDBC/ODBC driver.");
    return;
    Statement stmt = null;
    Connection con=null;
    try {
    con = DriverManager.getConnection (URL,username,password);
    stmt = con.createStatement();
    } catch (Exception e2) {
    System.out.println("problems connecting to "+URL);
    try {
    ResultSet result = stmt.executeQuery("SELECT * FROM ModemTable;");
    result.next(); // move to first row
    String name = result.getString("PhoneNumber");
    String temp = "";
    //int cups = result.getInt("cups");
    System.out.println("SELECT * FROM ModemTable;\nPhonenumber=\n "+name);
    // init the OracleXMLQuery; note we could have passed the sql query string
    // instead of the ResultSet
    OracleXMLQuery qry = new OracleXMLQuery(con,result);
    // get the XML document is the string format
    String xmlString = qry.getXMLString();
    // print out the result
    System.out.println(" OUPUT IS:\n"+xmlString);
    con.close();
    }catch (Exception e3) {
    // e.printStackTrace();
    System.out.println("error:"+e3.toString());
    ----------------------------------------

    Are you using JDBC/ODBC to access Oracle,
    or another database? Either should work,
    but just for diagnosing the problem.
    If Oracle, are you using Oracle8 object
    types in your queries?
    Thanks.

  • OracleXMLQuery generates java.lang.OutOfMemoryError

    Hi all,
    I am using OracleXMLQuery( ) to generate XML file from the contents of a table. I have almost 30000 rows in the table with each row containing 30 columns.
    The code to fetch the data and form an XML File goes like this
    st_CountRowsInView = conn.createStatement();
    outputFile = new File(outputFilePath);
    outputFile.createNewFile();
    outFile = new FileWriter(outputFile);
    sqlStatement = "select * from " + viewName;
    qry = new OracleXMLQuery(conn, sqlStatement);
    qry.keepObjectOpen(true);
    qry.setRaiseException(true);
    qry.setRowsetTag("RowSet");
    qry.setEncoding("UTF-8");
    qry.setDateFormat(dateFormat);
    //Make the rowtag equivalent to the alias name
    qry.setRowTag(aliasName);
    qry.setRowIdAttrName(null);
    qry.setRowIdAttrValue(null);
    outFile.write(qry.getXMLString());
    qry.close();
    outFile.close();
    The above code works fine when there are 100 records. But the same code throws outOfmemory error when the number of rows increases. Kindly help me to rectify the problem.

    Issues related to pre 9.2.x database are not discussed in this forum. Please read the forum introduction for details for which forums should be used to discuss XML processing in legacy databases.
    If you have the option of upgrading to database 9.2.0.3.0 or later I would start by reading the XML DB application developer's guide for the topics I mentioned in my earlier post

  • XDK getXMLDOM() problem

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import oracle.xml.sql.query.OracleXMLQuery;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    I have the following code
    OracleXMLQuery qry = null;
         try{
         qry = new OracleXMLQuery(conn,query);          
         }catch(Exception e){
              System.out.println("XML problem = " + e);
    // structure the generated XML document
    //qry.setMaxRows(2); // set the maximum number of rows to be returned
    qry.setRowsetTag("EMPINFO"); // set the root document tag
    qry.setRowTag("DBROW"); // sets the row separator tag
    // get the XML document in string format
    String xmlString;
         try {
              //xmlString = qry.getXMLString();
              Document xmlDoc = qry.getXMLDOM();
         //System.out.println(" OUTPUT IS:\n"+xmlString);
         //NodeList nodelist = xmlDoc.getElementsByTagName("DBROW");
         NodeList nodelist = xmlDoc.getChildNodes();
         System.out.println("The number of child nodes = " + nodelist.getLength());
    I know the results will have several records(DBROW) but for some reason I only get nodelist length of 1. Am I missing something? I know that the XML is generated but I don' t know if the xmlDoc is generated correctly.
    Any help would be greatly appreciated.
    Message was edited by:
    user539133

    NodeList nodelist = xmlDoc.getChildNodes();
    returns the root document tag EMPINFO, which is only 1 in the XML document.

  • XSU updateXML problems

    Hi,
    I've a table, tab sequence, with the following structures:
    Name Null? Type
    TABLENAME NOT NULL VARCHAR2(50)
    SEQUENCE_NO NUMBER(10)
    I've generated an XML document, abc.xml, using the following code segments:
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    import java.lang.*;
    import java.sql.*;
    import java.io.*;
    // class to test the String generation!
    class testXMLSQL {
    public static void main(String[] argv)
    try{
    // create the connection
    Connection conn = getConnection("john","ajohn");
    // Create the query class.
    OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from tabsequence");
    // Get the XML string
    String str = qry.getXMLString();
    // Print the XML output to screen
    // System.out.println(" The XML output is:\n"+str);
    writeToFile("abc.xml",str);
    // Always close the query to get rid of any resources..
    qry.close();
    }catch(SQLException e){
    System.out.println(e.toString());
    // Get the connection given the user name and password..!
    private static Connection getConnection(String username, String password)
    throws SQLException
    // register the JDBC driver..
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    // Create the connection using the OCI8 driver
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@10.37.108.122:1220:lslva",username,password);
    return conn;
    private static void writeToFile(String fileName,String fileContent) {
    try {
         FileOutputStream fo=new FileOutputStream(fileName);
         PrintStream ps=new PrintStream(fo);
         ps.println(fileContent);
         ps.close();
         fo.close();
    catch(Exception ex){
         System.out.println(ex);
    After I've made some modifications to the 'sequence_no' of the abc.xml,
    I've attempted to execute the following code segment to update the
    tabsequence table:
    import java.sql.*;
    import oracle.xml.sql.dml.OracleXMLSave;
    import java.net.*;
    public class testUpdate
    public static void main(String argv[])
    throws SQLException
    String tabName = "tabsequence";
    String fileName = "abc.xml";
    Connection conn = getConnection("john","ajohn");
    OracleXMLSave sav = new OracleXMLSave(conn, tabName);
    String [] keyColNames = new String[1];
    keyColNames[0] = "TABLENAME";
    sav.setKeyColumnList(keyColNames);
    String[] updateColNames = new String[2];
    updateColNames[0] = "SEQUENCE_NO";
    sav.setUpdateColumnList(updateColNames);
    URL url = sav.getURL(fileName);
    int rowCount = sav.updateXML(url);
    sav.close();
    System.out.println(" Successfully updated "+rowCount+ " rows into "+ tabName);
    conn.close();
    // Get the connection given the user name and password..!
    private static Connection getConnection(String user, String passwd)
    throws SQLException
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@10.37.108.122:1220:lslva",user,passwd);
    return conn;
    It always gives me the following error message:
    Exception in thread "main" oracle.xml.sql.OracleXMLSQLException: NULL NOT A VALID COLUMN NAME.
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2361)
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2233)
    at oracle.xml.sql.dml.OracleXMLSave.updateXML(OracleXMLSave.java:1595)
    at testUpdate.main(testUpdate.java:26)
    PLEASE HELP! THANKS

    Hi,
    I think there is a problem with the definition of the columns to be updated :
    String[] updateColNames = new String[2];
    updateColNames[0] = "SEQUENCE_NO";
    sav.setUpdateColumnList(updateColNames);
    You fill only the first element of the array, the second one is null!
    Try
    String[] updateColNames = new String[1];
    instead...
    However, I haven't tried it out!
    HTH,
    Bernhard

  • Convert Query to OracleXMLQuery

    Hi,
    We're trying to convert a query to XML using OracleXMLQuery, inside a servlet using OAS.
    When we compile and run it in JDeveloper, it works fine. But in the OAS 4.8.0.2 the aplication bail's out!
    Thanx in advance.
    Here is the code we are experimenting with:
    /*we are putting the output to a file for debugging
    import java.sql.*;
    import oracle.xml.sql.query.*;
    import oracle.jdbc.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.dml.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    public class TestServlet extends HttpServlet {
    //Initialize global variables
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    //Process the HTTP Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = new PrintWriter (response.getOutputStream());
    try {
    FileOutputStream f =new FileOutputStream("output.log");
    PrintWriter fout = new PrintWriter(f,true);
    fout.println("<html>");
    fout.println("<head><title>TestServlet</title></head>");
    fout.println("<body>Hello From TestServlet doGet()");
    //Load (and therefore register ) the Oracle Driver
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    // get a connection name
    Connection con =(Connection) DriverManager.getConnection("jdbc:oracle:thin:system/[email protected]:1521:SIGLABD");
    //create a stament object
    Statement stmt = con.createStatement();
    //Execute a SQL Query
    ResultSet rs = stmt.executeQuery("SELECT IDENTIFICADOR, NOME FROM SYSTEM.USERNAME");
    fout.println("ligacao obtida");
    String query = "select * from responsabilidade";
    Statement stmt2 = con.createStatement();
    fout.println("Statement created");
    ResultSet rs2 = stmt2.executeQuery (query);
    fout.println("Query done!!!");
    OracleXMLQuery qry=new OracleXMLQuery(con, rs2);
    fout.println("XML conversion!!! Ok");
    String str = qry.getXMLString();
    qry.close();
    fout.println("ExecutaQuery(String):Fim "+ str);
    fout.println("</body></html>");
    fout.close();
    } catch (Exception e){ out.println(e.toString());}
    //Get Servlet information
    public String getServletInfo() {
    return "TestServlet Information";
    Our OAS cartridge classpath is:
    :\wwwsigla\servlets\oraclexmlsql.jar;c:\wwwsigla\servlets\dcxjp.zip;%ORAWEB_HOME%\classes\services.jar;%ORACLE_HOME%\ows\cartx\jweb\classes\jweb.jar;%ORACLE_HOME%\ows\cartx\jweb\cl asses\jservlet.jar;%ORACLE_HOME%\orb\classes\yoj.jar;%ORAWEB_HOME%\classes\cosnam.jar;%ORACLE_HOME%\orb\classes\session.jar;%ORACLE_HOME%\orb\classes\cache.jar;%ORACLE_HOME%\jdbc\l ib\classes111.zip;%ORACLE_HOME%\ots\classes\oraclejts.jar;%ORACLE_HOME%\ots\classes\jtsjdbc.jar;%ORAWEB_HOME%\classes\ecoapi.jar;%ORAWEB_HOME%\classes\ejbapi.jar;%ORAWEB_HOME%\clas ses\oasdeploy.jar

    I have a similar problem. I can get a class that I've written to work with JDeveloper.
    However when I try to use it as a stored procedure I can't get it deployed nor compiled in the db if I load it using loadjava. I have spent hours on this problem And have sent two Topics in here regarding this.
    I have also tried do load the whole jar into the database but after loading it, it is also not compilable. Someone suggest that this whole problem had to do with db priviliges but I've checked that and I can rule that out.
    I then tried to use the Oracexmlsql package int a servlet but I can't get that to work either (I have got other servlets working but not using the one using oraclexmlsql.jar).
    I reckon that the problem lies within the package or OAS.
    If you find out something about this problem, please keep me posted.
    Andre
    null

  • XDK - DTD Generation using OracleXMLQuery

    I have been using (and enjoying) the XDK for the last month. However, I have a problem - I want to generate a DTD for a given RBD table without any associated XML. To date, I have not been able to accomplish this task. I provided a simple example below. When I print the XML using 'qry.getXMLString(true)' the DTD is intact. But, when I generate a DOM from the query and then extract the documentType it contains nulls - In fact, the DTD name is null.
    // Don't care about data, just the DTD
    ResultSet rset = stmt.executeQuery("select * from mytable");
    OracleXMLQuery qry = new OracleXMLQuery(conn,rset);
    qry.setMaxRows(1);
    // OK - prints internal DTD and XML
    System.out.println(qry.getXMLString(true));
    // Get the DOM
    Document doc = qry.getXMLDOM(true);
    DocumentType dt = doc.getDoctype();
    // PROBLEM - Returns null
    System.out.println(dt.getName());
    Thanks for the help.
    Joe

    The DTD class generator supports DOCTYPE. The generate() method "Traverses the DTD with element doctype as root and generates Java classes."
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96616/arxml07.htm#1005265

Maybe you are looking for

  • I have two computers with diffrent folders

    i imported two aol mail boxes to each of my two computers. now my mail folders are different on each computer .mac I want to merge the folders not replace them. after several attempts I got the folders to be copied in the server area below, but there

  • Want to reinstall iPhoto only

    Hi all, okay, I'm an idiot (and A Luddite to boot). I did something stupid and short story is I have uninstalled iPhoto 4.0.3 from OS 10.3.9. I've tried dragging a working copy from another disk but no luck. Can anyone recommend a reasonably straight

  • Why do colours change when converting from Word to PDF

    I am converting word files to pdf, however the header and footer background colours change once converted. How can I stop this happening?

  • Word 2013 table of contents duplicated in PDF

    I have a large MS Word document - 326 pages, 56 thousand words and hundreds of images.  I have a table of contents in my word document.  When I use the MS Word "Save as Adobe PDF" to turn it into PDF, the finished document contains TWO tables of cont

  • How to implement session varibles and how to use it

    how to implement session varibles and how to use it.ple help me