OracleXMLSQLException

I'm posting this msg again.
I'd like to get an answer ASAP.
Please...
Thanks.
I'm trying to load XML file into Oracle.
After I download the beta version (9.0.0.0.0 Beta release of the XDK), I got this error :
oracle.xml.sql.OracleXMLSQLException: 'java.lang.NumberFormatException: 12.5' encountered during processing ROW element 0.
All prior XML row changes were rolled back. in the XML document.
at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2196)
at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1269)
at load_company.main(load_company.java:613)
It was successfully loaded with the previous version of XSU. But, there was a XML file size limit. That's why I got the latest version of XSU. The XML file is same as before.
* input file (a small sample)
<?xml version="1.0" ?>
<ROWSET>
<ROW>
<value1>330000</value1>
<date1>09-FEB-1998</date2>
<price>12.5</price> ==> this's causing a problem
<state>NJ</state>
<value2>-1200</value2> ==> this's causing a problem
</ROW>
</ROWSET>
* target table
column : price
datatype : number(11,2)
column : value2
datatype : number(11,2)
I think if the number value has decimal point (e.g. 23.01) or negative number (e.g. -300), then it cause an error.
null

This must be a new bug. I can reproduce with Oracle8i 8.1.7 using either the 8.1.7 JDBC driver or the Oracle9i Beta JDBC driver (not publically available yet).
Here's what I did:
create table testtab( name varchar2(10), val number(11,2));The XML I try to insert is:
<ROWSET>
<ROW>
<NAME>Steve</NAME>
<VAL>12.5</VAL>
</ROW>
</ROWSET>The command I try to execute is:
E:\xml\xdk9_0_0_0>java OracleXML putXML
-user "scott/tiger"
-conn "jdbc:oracle:thin:@localhost:1521:ORCL"
-fileName test.xml
testtab
oracle.xml.sql.OracleXMLSQLException: 'java.lang.NumberFormatException: 12.5' en
countered during processing ROW element 0. All prior XML row changes were rolled back. in the XML document.
oracle.xml.sql.dml.OracleXMLSave.saveXML(org.w3c.dom.Document, int)The workaround is to create a view that "casts" these number columns to strings like this:
create view testtabview as select name, to_char(val) as val from testtab;
SQL> create trigger testtabviewtrig
2 instead of insert on testtabview for each row
3 begin
4 insert into testtab(name,val) values (:new.name, :new.val);
5 end;
6 .
SQL> /
Trigger created.Then repeat the OracleXML command above against the testtabview instead.
Then I get:
successfully inserted 1 rows into testtabview

Similar Messages

  • 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.

  • Query handled OK on Oracle server but XSQL Servlet raises OracleXMLSQLException

    After dropping and recreating certain object types, and then using ALTER TYPE on an object dependent on those object types, XSQL Servlet raises exception for a query that is handled fine in the Oracle Server itself (ie, in SQL*Plus) as in the following test case:
    create or replace type o_object_inner as object( char1 char(1) )
    create or replace type n_nested_table as table of o_object_inner
    create or replace type o_object_outer as object (nNestedTab n_nested_table)
    For above, the following query encounters no problems on Oracle Server or in XSQL servlet:
    Select o_object_outer(NULL) as "theOuterObj" from dual
    But then if object types are modified as follows:
    drop type o_object_inner force
    create or replace type o_object_inner as object( char1 char(1) ) --same as above
    drop type n_nested_table force
    create or replace type n_nested_table as table of o_object_inner --same as above
    alter type o_object_outer compile
    The above query now encounters no problems in SQL*Plus but generates exception in XSQL servlet as follows:
    oracle.xml.sql.OracleXMLSQLException: Internal Error: Unable to resolve name
    More complex cases generated the above exception and/or the following exception:
    oracle.xml.sql.OracleXMLSQLException: Internal Error: Invalid ADT attribute
    Any insight or help would be greatly appreciated!
    Other info:
    Oracle Server 8.1.7.3 on HP-UX
    XDK 9.2.0.1 (Production) for Java on NT
    JDBC/OCI8 drivers for NT (latest for 8.1.7)

    Yes,
    I changed most of the cursor functions to cast(multiset()). Sometimes i divided a big query into two or three queries (when there was cursor nested in a cursor). It was one day work for me. Don't forget to change the tags with ROW to ITEM in your xsl-stylesheets.
    Uwe

  • Oracle.xml.sql.OracleXMLSQLException: Expected name instead of .

    Hi,
    I'm using XDK in Tomcat to execute queries and get the XML result in the browser. I have written many queries but now I'm having problems in one of them.
    The error output that I see in my browser is this one:
    <ROOT>
    <ERROR>
    oracle.xml.sql.OracleXMLSQLException: Expected name instead of <.
    </ERROR>
    </ROOT>:
    This error message is known as XML-20126 but it's not documented in the XML Developer's Kit Programmer's Guide, so I don't know what to do.
    My XSQL query is the following:
    <ROOT connection="xxxx_read" xmlns:xsql="urn:oracle-xsql">
    <xsql:query>
    SELECT XMLAGG(XMLELEMENT("NODE",
    XMLELEMENT("name", b.nodename),
    (SELECT XMLAGG(XMLELEMENT("SERVICE",
    XMLATTRIBUTES(a.serviceabbr AS "type")
    ORDER BY a.serviceabbr
    FROM service a, serviceinstance c
    WHERE c.isdeleted='N'
    AND a.serviceid=c.serviceid
    AND c.nodeid=b.nodeid
    ORDER BY b.nodename
    ) AS "NODES"
    FROM node b
    WHERE b.isdeleted='N'
    </xsql:query>
    </ROOT>
    That query executes fine in sqlplus, where I can see the XML result.
    I think my problem could be related to the size of the XML output. In sqlplus, the output has around 38000 bytes size, which is nothing, so I don't really know why that should be a problem. Do you have any idea?
    Thanks for your help,
    David

    So it seems there is a problem in fact:
    XDB FUNCTION RESULTS ARE TRUNCATED WHEN USING XSQL
    *** 02/25/04 08:28 am ***
    Problem Description
    There appears to be a limit on the content or characters that XSQL pages
    handle when being passed data from XDB functions such as XMLAGG() and
    XMLELEMENT().
    If you have a xsql page of the form
    < ?xml version="1.0"?>
    < xsql:query xmlns:xsql="urn:oracle-xsql" connection="demo" >
    select XMLAgg(XMLElement("Test", XMLAttributes(i.id as "Id_van_de_test",
    i.name as "Name_van_de_test"))) as "Tests" from problem_xml i
    < /xsql:query>
    If the number of rows (or amount of data) in the table is low, the result
    appears okay. However, if the data returned is large the data appears to
    truncate giving xml parsing errors as if the xml returned is not well formed.
    In the testcase provided, the error is as follows :-
    Results from 10.1.0.2
    < Line 2, Column 16354>: XML-20126: (Fatal Error) '< ' cannot appear in attribute value.
    < Line 2, Column 16366>: XML-20190: (Fatal Error) Whitespace required.
    < Line 2, Column 16366>: XML-20201: (Fatal Error) Expected name instead of 4.
    < ?xml version = '1.0'?>
    value.< /ERROR>
    Results from 9.2.0.6
    < Line 2, Column 16354>: XML-0126: (Fatal Error) '< ' cannot appear in attribute value.
    < Line 2, Column 16368>: XML-0190: (Fatal Error) Whitespace required.
    < Line 2, Column 16368>: XML-0201: (Fatal Error) Expected name instead of 3.
    < Line 2, Column 16371>: XML-0122: (Fatal Error) '=' missing in attribute.
    < Line 2, Column 16391>: XML-0190: (Fatal Error) Whitespace required.
    < Line 2, Column 16396>: XML-0122: (Fatal Error) '=' missing in attribute.
    < Line 2, Column 16397>: XML-0125: (Fatal Error) Attribute value should start with quote.
    < ?xml version = '1.0'?>
    value.< /ERROR>
    And the workaround:
    ======================================================
    The only workaround we have is to get the Document generated using
    DBMS_XMLQUERY [with expanded entities].
    _==Start===
    create or replace procedure Query2XML(QueryString varchar2 default
    'select col1 from xml_tab where r_id = ?') IS
    XMLCtx number;
    myXML clob;
    myXMLLength number;
    BEGIN
    XMLCtx := DBMS_XMLQUERY.NEWCONTEXT(QueryString);
    myXML := DBMS_XMLQUERY.GETXML(XMLCtx);
    myXMLLength := DBMS_LOB.GETLENGTH(myXML);
    DBMS_XMLQUERY.CLOSECONTEXT(XMLCtx);
    END Query2XMLFile;
    _==Start===
    Currently, XDB uses a DOM based model for XSLT evaluation. It is not
    possible to support disable-output-escaping constructs through this
    evaluation. This might be supported in a future release when a different
    model is implemented.
    =============================================================

  • Oracle.xml.sql.OracleXMLSQLException:Cannot enable auto commit within JTS transaction

    Hi All,
    OracleXMLSave class in the Oracle XDK is being used to load XML data into an 8170 database. The Java code is running in IBM WebSphere with container-managed transactions. When JTA is enabled with the Merant JDBC driver for Oracle, we get the following error when the XML is loaded:
    oracle.xml.sql.OracleXMLSQLException: Cannot enable auto commit within JTS
    transaction
         at java.lang.Throwable.fillInStackTrace(Native Method)
         at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2213)
         at oracle.xml.sql.dml.OracleXMLSave.insertXML(Compiled Code)
    This suggests the OracleXMLSave class is not aware of the fact that it is now operating in a JTS transaction where control is managed elsewhere. i.e. should also not attempt to commit or rollback, as this is the responsibility of the container.
    Is there a property which needs to set to prevent the above or does the XDK not work with J2EE (JTS) transactions?.
    If you have any useful comments, let me know. Testing the above presents me with a number of problems so if this is easily explained , let me know.
    Thanks,
    Malcolm

    Clearly , there does seem to be something a bit odd with the above stack.
    <Bug:1917808> mentions OracleXMLSave in context of plsql equivalent : dbms_xmlsave . i.e dbms_xmlsave is a wrapper around OracleXMLSave class.
    disabling autocommit on connection as follows should help:
    conn = DriverManager.getConnection("connect string","scott","tiger");
    conn.setAutoCommit(false);
    to disble auto commit and see if this has an effect.
    This issue might be <Bug:1497506>. If disabling autocommit does not work then it appears that it could be this issue .
    Malcolm
    Hi All,
    OracleXMLSave class in the Oracle XDK is being used to load XML data into an 8170 database. The Java code is running in IBM WebSphere with container-managed transactions. When JTA is enabled with the Merant JDBC driver for Oracle, we get the following error when the XML is loaded:
    oracle.xml.sql.OracleXMLSQLException: Cannot enable auto commit within JTS
    transaction
         at java.lang.Throwable.fillInStackTrace(Native Method)
         at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2213)
         at oracle.xml.sql.dml.OracleXMLSave.insertXML(Compiled Code)
    This suggests the OracleXMLSave class is not aware of the fact that it is now operating in a JTS transaction where control is managed elsewhere. i.e. should also not attempt to commit or rollback, as this is the responsibility of the container.
    Is there a property which needs to set to prevent the above or does the XDK not work with J2EE (JTS) transactions?.
    If you have any useful comments, let me know. Testing the above presents me with a number of problems so if this is easily explained , let me know.
    Thanks,
    Malcolm

  • JDeveloper Error ! oracle.xml.sql.OracleXMLSQLException: Cannot map Unicode

    Hi All,
    I have 2 identical table structures with different data in Oracle.
    I am using following xsql and XSLT sheet to produce xml files with these tables. ( have to run twice xsql file by changing the Table names )
    When I run the xsql file with Table1, it works fine, produced the xml file on the browser.
    But when I run the xsql file with Table2, it gives following error message:
    The XML page cannot be displayed
    Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'http://192.10.1.14:8988/Workspace_ONIX-ONIX2-context-root/untitled1.xsql'. Line 1, Position 1
    oracle.xml.sql.OracleXMLSQLException: Cannot map Unicode to Oracle character.
    ^
    These two are my xsql and xslt files:
    - - - - xsql file - - - -
    <?xml version = '1.0' encoding = 'windows-1252'?>
    <?xml-stylesheet type="text/xsl" href="TT14.xsl"?>
    <xsql:query connection="Connection1" id-attribute="" tag-case="lower"
    rowset-element="LIST" row-element="DEPA"
    xmlns:xsql="urn:oracle-xsql">
    SELECT * from TT26
    </xsql:query>
    TT14.xsl file
    <xsl:stylesheet version="1.0" encoding="UTF-8" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method ="xml" indent= "yes" encoding="UTF-8"/>
    <!--DOCTYPE ONIXmessage SYSTEM "http://www.editeur.org/onix/2.1/reference/onix-international.dtd"-->
    <xsl:template match ="list">
    <BBMessage>
    <<xsl:for-each select="depa">
    <Product>
    <RecordReference>
    <xsl:value-of select="wai"/>
    </RecordReference>
    <NotificationType>
    <xsl:value-of select="wantype"/>
    </NotificationType>
    </Product>
    </xsl:for-each>
    </BBMessage>
    </xsl:template>
    </xsl:stylesheet>
    All comments are highly welcomed...
    Thanks

    Hi Deepak
    Thanks for the post, but I am afraid that's not the issue with the error.
    I changed both encoding to "UTF-8" still i get the problem.
    I tried even without the XSLT sheet, still I have the problem..
    - - - - xsql file ---
    &lt;?xml version = '1.0' ?&gt;
    &lt;!--
    | Uncomment the following processing instruction and replace
    | the stylesheet name to transform output of your XSQL Page using XSLT
    &lt;?xml-stylesheet type="text/xsl" href="YourStylesheet.xsl" ?&gt;
    --&gt;
    &lt;page xmlns:xsql="urn:oracle-xsql" connection="Connection1"&gt;
    &lt;xsql:query max-rows="-1" null-indicator="no" tag-case="lower"&gt;
    select * from Table2
    &lt;/xsql:query&gt;
    &lt;/page&gt;
    - - - - Result ----
    &lt;?xml version="1.0" ?&gt;
    - &lt;!--
    | Uncomment the following processing instruction and replace
    | the stylesheet name to transform output of your XSQL Page using XSLT
    &lt;?xml-stylesheet type="text/xsl" href="YourStylesheet.xsl" ?&gt;
    --&gt;
    - &lt;page&gt;
    &lt;error&gt;oracle.xml.sql.OracleXMLSQLException: Cannot map Unicode to Oracle character.&lt;/error&gt;
    &lt;/page&gt;
    Any Comment ???
    Thanks

  • Oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XM

    I need to use query-database functionality in transform activity to make a stored function call. My sql query parameter should be
    Select CDMB_BPEL_UTILS_PKG.get_coa(null) from dual
    Corresponding XML is
    ?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://www.example.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" exclude-result-prefixes="xsl ns0 xsd ldap xp20 bpws ora orcl">
    <xsl:template match="/">
    <ns0:OracleRoot>
    <ns0:OracleMappedOut>
    <ns0:ExpType>
    <xsl:value-of select="orcl:query-database('select cdmb_bpel_utils_pkg.get_coa(null) from dual',false(),false(),'eis/JNDI/GDB2')"/>
    </ns0:ExpType>
    </ns0:OracleMappedOut>
    =========But I get the following error when testing the same===========
    oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XML tag name
    ========================================================
    I guess I need to use escape characters to pass ( . I tried using &quot; and &apos; but in vain. Any help is appreciated to resolve this issue.

    Siva,
    version: 10.1.3.4
    Your inputs may be of high use for me as well.
    I have similar requirement. I have to execute the following sql query
    select sum(salary) from emp. When I run this query using ora:orcl:query-database, I got the same exception what you have got. So do you mean if i use an alias for this, it would solve my pbm?
    select sum(salary) sal from emp+
    rgds,
    sen

  • Oracle.xml.sql.OracleXMLSQLException

    this is my code:
    try{
    Connection con=dbh.GetConnection();
    Statement s=con.createStatement();
    ResultSet rs=s.executeQuery("select * from tg_tbl");
    OracleXMLQuery qry = new OracleXMLQuery(con,rs);
    String xmlString = qry.getXMLString();
    System.out.println(" OUPUT IS:\n" + xmlString);
    catch(Exception e){e.printStackTrace();}
    this result is:
    OUPUT IS:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: java.sql.SQLException</ERROR>
    can anyone tell me the reason

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
    Given what you've included in your posting it's hard to say. It could be any ORA- error. Table or view does not exist.
    If you change your query to
    "SELECT * FROM DUAL"
    does it work?<HR></BLOCKQUOTE>
    I know it now.The columnName should be used to replace the "*"
    null

  • XSU: OracleXMLSQLException thrown when column key is rowid.

    Hi All,
    I run into a problem where I wanted to update a column which is the key. Let's say I have table
    create table XYZ (
    key varchar2(20),
    name varchar2(20)
    Using SQLPLUS, it is possible to do:
    update XYZ
    set (key='123', name='joe')
    where
    rowid='AAABrXAAEAAAJL1AAH';
    rowid is the unique identifier assigned by oracle to each row.
    the following is returned using OracleXMLQuery and saved into xml_file.
    <rowset>
    <row num="1">
    <key>123</key>
    <name>joe</name>
    <rowid>AAABrXAAEAAAJL1AAH</rowid>
    </row>
    </rowset>
    I change the value of key and name columns and I try to update the row using the following code:
    OracleXMLSave query = new OracleXMLSave(conn, table);
    keyColNames[0]= "rowid";
    query.setKeyColumnList(keyColNames);
    query.updateXML(xml_file);
    An SQLException Exception is thrown:
    oracle.xml.sql.OracleXMLSQLException: Column 'rowid', specified to be a key column, does not not exits in table 'XYZ'.
    Since the updateXML method does not take the old and new value, is there a way to use a rowid as the unique Key to perform an update.
    I will appreciate any help.
    Thanks
    Sa

    I suggest you read this, otherwise you won't get much help...
    HOW TO: Post a SQL statement tuning request - template posting

  • XSU error oracle.xml.sql.OracleXMLSQLException: Conversion to String failed

    Appication Server: 10g, Database: Oracle 9i and Oracle 10g
    I have a table 'sw_icd2' in the database that has one column of XMLType.
    The code below, attempts to query this table as 'select * from sw_icd2' and display the result. I was able to execute this query in sqlplus.
    But when I run a program using XSU in JDeveloper:
    OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from sw_icd2");
    XMLDocument domDoc = (XMLDocument)qry.getXMLDOM();
    domDoc.print(System.out);
    StringWriter s = new StringWriter(10000);
    domDoc.print(new PrintWriter(s));
    System.out.println(s.toString());
    qry.close();
    I get the following Error:
    "oracle.xml.sql.OracleXMLSQLException: Conversion to String failed"
    Any ideas on how I can resolve this issue? Your help would be appreciated.
    Thanks!

    Okay, it looks like the problem has something to do with the TIMESTAMP data type in tables.
    oracle.xml.sql.query.OracleXMLQuery can't seem to handle tables with the TIMESTAMP data type.
    this code ran fine on my machine :
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    import java.lang.*;
    import java.sql.*;
    public class testXMLSQL {
         public static void main(String[] args) {
    try {
    // Create the connection
    System.out.println("before getConnection ");
    Connection conn = getConnection("scott","tiger");
    System.out.println("after getConnection ");
    // Create the query class
    OracleXMLQuery qry = new OracleXMLQuery(conn, "SELECT * FROM EMP");
    System.out.println("after OracleXMLQuery object created ");
    // Get the XML string
    String str = qry.getXMLString();
    // Print the XML output
    System.out.println("The XML output is:\n"+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:@<server_name>:1521:<sid>",
    username,password);
    return conn;
    Then I created another table :
    create table emp_test as select * from emp;
    added a timestamp to it :
    alter table emp_test add (time timestamp(6));
    and filled it with timestamp information :
    update emp_test set time = timestamp'2005-09-22 09:26:50.124';
    ran the same code but changed the SQL to :
    "SELECT * FROM EMP_TEST"
    and got the error message :
    The XML output is:
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: Conversion to String failed</ERROR>
    looks like bug in OracleXMLQuery object??

  • Oracle.xml.sql.OracleXMLSQLException: getCollectionMetaData:

    The following Java code:
    // Create an OracleOCIConnectionPool instance with default configuration
    OracleOCIConnectionPool cpool = new OracleOCIConnectionPool("appserver", "9ias", url, null);
    // Print out the default configuration for the OracleOCIConnectionPool
    System.out.println ("-- The default configuration for the OracleOCIConnectionPool --");
    displayPoolConfig(cpool);
    // Get a connection from the pool
    OracleOCIConnection conn1 = (OracleOCIConnection) cpool.getConnection("usecase", "uml");
    // Create a Statement
    Statement stmt = conn1.createStatement ();
    // Select the ENAME column from the EMP table
    ResultSet rset = stmt.executeQuery ("select * from usecases_ov");
    OracleXMLQuery q = new OracleXMLQuery(conn1,"select * from usecases_ov");
    System.out.println(q.getXMLString());
    Produces:
    -- The default configuration for the OracleOCIConnectionPool --
    Min poolsize Limit: 1
    Max poolsize Limit: 1
    Connection Increment: 0
    NoWait: false
    Timeout: 0
    PoolSize: 1
    ActiveSize: 0
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: getCollectionMetaData: this method is not supported by 'OracleXMLDataSetGenJdbc' class. Please use 'OracleXMLDataSetExtJdbc' instead.</ERROR>
    Is there a workaround?

    Solved:
    Replace the last three lines of the above code with -
    I replaced the corresponding section of the above code with:
    ResultSet rset = stmt.executeQuery ("select * from usecases_ov");
    OracleXMLDataSetExtJdbc dset =
    new OracleXMLDataSetExtJdbc(conn1, "select * from usecases_ov");
    OracleXMLQuery q = new OracleXMLQuery(dset);
    System.out.println(q.getXMLString());

  • Oracle XML SQL utility, error oracle.xml.sql.OracleXMLSQLException:....

    I am using Oracle XML SQL utility to generate some XML using CURSOR
    operator.
    Following is the query -
    SELECT PROJECT.PROJ_CD,
    PROJECT.PROJ_TITLE,
    CURSOR(SELECT ISSUES.ISSUE_ID
    FROM ISSUES
    WHERE PROJECT.PROJ_ID = ISSUES.PROJ_ID )
    as ISSUES_DATA
    FROM PROJECT
    WHERE PROJECT.PROJ_ID = 1
    This query works fine when I create a direct connection using Oracle JDBC
    thin driver. But when I execute same thing using a connection from a
    Weblogic connection pool (which uses exactly the same Oracle JDBC thin
    driver, classes12.zip), I get following error-
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: cursorGetMetaData: this method
    is not supported by OracleXMLDataSetGenJdbc' class. Please use
    'OracleXMLDataSetExtJdbc' instead.</ERROR>
    Following are the details about my environment:
    Weblogic5.1 on Windows NT 4.0
    Oracle 8.1.5 on Sun Solaris
    Oracle JDBC thin Classes12.zip (from Oracle 8.1.6)
    Oracle XML SQL utility XSU12_ver1_2_1
    Does anyone have any idea what is going on. Please help.
    Thanks.

    Thanks for your reply.
    Here is what I am doing:
    I have connection pool defined in welogic.properties file
    weblogic.jdbc.connectionPool.oraclePool=\
    url=jdbc:oracle:thin:@192.168.2.251:1521:orcl,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=15,\
    capacityIncrement=1,\
    allowShrinking=true,\
    shrinkPeriodMins=5,\
    refreshMinutes=5,\
    testTable=,\
    props=user=someuser;password=somepasswd
    weblogic.allow.reserve.weblogic.jdbc.connectionPool.oraclePool=everyone
    weblogic.jdbc.TXDataSource.orclDataSource=oraclePool
    Then I have a DBConnection class which gets connection from the pool
    following is some code from DBConnection class
    private Connection con = null;
    private DataSource ds = null;
    private String providerURL;
    private String dataSource;
    private String contextFactory;
    private IpmsProps ipmsProp = null;
    public Connection getConnection() {
    if ( con == null ) {
    try {
    ipmsProp = IpmsProps.getInstance();
    providerURL = ipmsProp.getProviderURL();
    dataSource = ipmsProp.getDataSource();
    contextFactory = ipmsProp.getContextFactory();
    Properties p = new Properties();
    p.put(javax.naming.Context.PROVIDER_URL, providerURL);
    p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
    contextFactory);
    Context ctx = new InitialContext(p);
    Context ctx = new InitialContext();
    ds = (DataSource) ctx.lookup(dataSource);
    con = ds.getConnection();
    } catch (Exception e) {
    System.out.println("Error While creating connection! " +
    e.toString());
    } // catch
    I Hope you will be able to provide me some work around.
    Thank you very much for the help.
    Rajinder.
    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    Hi. It's probably because you're calling some Oracle-specific method,passing it
    a pool JDBC object, and though the Oracle methos signature says it will
    take a generic java.sql.XXX object, it really is going to assume the thingis
    an Oracle class, and fails when it tries to cast it to such.
    Depending on how you're getting your pool connection, I may have aworkaround.
    Joe
    Rajinder Arora wrote:
    I am using Oracle XML SQL utility to generate some XML using CURSOR
    operator.
    Following is the query -
    SELECT PROJECT.PROJ_CD,
    PROJECT.PROJ_TITLE,
    CURSOR(SELECT ISSUES.ISSUE_ID
    FROM ISSUES
    WHERE PROJECT.PROJ_ID =
    ISSUES.PROJ_ID )
    as ISSUES_DATA
    FROM PROJECT
    WHERE PROJECT.PROJ_ID = 1
    This query works fine when I create a direct connection using OracleJDBC
    thin driver. But when I execute same thing using a connection from a
    Weblogic connection pool (which uses exactly the same Oracle JDBC thin
    driver, classes12.zip), I get following error-
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: cursorGetMetaData: thismethod
    is not supported by OracleXMLDataSetGenJdbc' class. Please use
    'OracleXMLDataSetExtJdbc' instead.</ERROR>
    Following are the details about my environment:
    Weblogic5.1 on Windows NT 4.0
    Oracle 8.1.5 on Sun Solaris
    Oracle JDBC thin Classes12.zip (from Oracle 8.1.6)
    Oracle XML SQL utility XSU12_ver1_2_1
    Does anyone have any idea what is going on. Please help.
    Thanks.--
    PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advancedpositions
    for people who want to work with Java, XML, SOAP and E-Commerceinfrastructure products.
    We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San JoseCA.
    Send resumes to [email protected]

  • OracleXMLSQLException: 6-byte UTF8 encoding not supported

    Hi,
    I am trying to upload XML data through the Oracle XML SQL Utility (XSU). I am running JDK 1.3.1 on the Windows client and 8.1.6 on the Solaris server. Now this works fine, but when the XML data contains German umlauts (dv|), I get the following exception:
    oracle.xml.sql.OracleXMLSQLException: 6-byte UTF8 encoding not supported.
         at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2093)
         at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1101)
    Since our database stores Umlauts (also through JDBC), I assume this has to do either with my client JVM or the Oracle libraries (xsu12.jar or xmlparserv2.jar)
    This is quite important to our project and as I don't know how to proceed, any help or suggestion is greatly appreciated.
    Thanks,
    Heiko

    Which version of XSU do you use? Would you send the sample data?

  • OracleXMLSQLException : NumberFormatException

    I'm trying to load XML file into Oracle.
    After I download the beta version (9.0.0.0.0 Beta release of the XDK), I got this error :
    oracle.xml.sql.OracleXMLSQLException: 'java.lang.NumberFormatException: 12.5' encountered during processing ROW element 0.
    All prior XML row changes were rolled back. in the XML document.
    at oracle.xml.sql.dml.OracleXMLSave.saveXML(OracleXMLSave.java:2196)
    at oracle.xml.sql.dml.OracleXMLSave.insertXML(OracleXMLSave.java:1269)
    at load_company.main(load_company.java:613)
    It was successfully loaded with the previous version of XSU. But, there was a XML file size limit. That's why I got the latest version of XSU. The XML file is same as before.
    Please, Any Idea?
    null

    * input file (a small sample)
    illustrating the part ). What does the look like ().
    <?xml version="1.0" ?>
    <ROWSET>
    <ROW>
    <value1>330000</value1>
    <date1>09-FEB-1998</date2>
    <price>12.5</price> ==> this's causing a problem
    <state>NJ</state>
    <value2>-1200</value2> ==> this's causing a problem
    </ROW>
    </ROWSET>
    * target table
    column : price
    datatype : number(11,2)
    column : value2
    datatype : number(11,2)
    I think if the number value has decimal point (e.g. 23.01) or negative number (e.g. -300), then it cause an error.
    null

  • OracleXMLSQLException: Exception d'E/S: End of TNS data channel UpdateXML

    Hi,
    I am trying to UpdateXML a XMLDocument to an Database Table and I have the famous TNS data channel error !
    here a part of my code :
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Connection conn =
    DriverManager.getConnection(
    "jdbc:oracle:thin:@localhost:1521:ORCL","user","password");
    THIS CONNECTION IS OK and I have no exception with another part of code which is doing an OracleXMLQuery !!
    OracleXMLSave save = new OracleXMLSave(conn, "ORCL.TABLETOUPDATE");
    String [] keyColNames = new String[1];
    keyColNames[0] = "ID_TABLETOUPDATE";
    save.setKeyColumnList(keyColNames);
    String[] updateColNames = new String[1];
    updateColNames[0] = "MY_COLUMN_TO_UPDATE";
    save.setUpdateColumnList(updateColNames);
    save.updateXML(xmldoc); >> this make the TNS exception (see after)
    save.close();
    here is the exception:
    System Error: oracle.xml.sql.OracleXMLSQLException: Exception d'E/S: End of TNS data channel
    System Error: int oracle.xml.sql.dml.OracleXMLSave.saveXML(org.w3c.dom.Document, int) (OracleXMLSave.java:1928)
    System Error: int oracle.xml.sql.dml.OracleXMLSave.updateXML(org.w3c.dom.Document) (OracleXMLSave.java:1372)
    System Error: void
    THANK YOU FOR A HELPING RESPONSE IN PARTICULAR FROM ORACLE TEAM
    I am using JDev 3.2 with Oracle 8.1.6 !!

    Thank's Steven for responding but It is still not working... even with UpdateXML(URL) and updating only a VARCHAR2 col
    even when it is stored in the DB.
    But the OracleXMLQuery works fine even with Object Types !!???
    The code below is more simple than your's !
    I show you the entire code :
    the result.xml file :
    <?xml version = '1.0' encoding = 'ISO-8859-1'?>
    <ROWSET>
    <ROW>
    <ID_PARAMETRE>16</ID_PARAMETRE>
    <TYPE_PARAMETRE>OUTOUT</TYPE_PARAMETRE>
    </ROW>
    </ROWSET>
    the row exists in DB !
    public static void main(String args[]) {
    MyClass.XSUloadXMLToOracle("d:\\Temp\\result.xml");
    static method ! (for Deployment if needed)
    class MyClass extends Object {
    public static void XSUloadXMLToOracle(String sFilePath) {
    try {
    Connection conn = ConnectionHelper.getConnection();
    OracleXMLSave save = new OracleXMLSave(conn, "PARAMETRE");
    String[] updateColNames = new String[1];
    updateColNames[0] = "TYPE_PARAMETRE";
    String [] keyColNames = new String[1];
    keyColNames[0] = "ID_PARAMETRE";
    save.setUpdateColumnList(updateColNames);
    save.setKeyColumnList(keyColNames);
    save.updateXML(save.getURL(sFilePath));
    conn.commit();
    save.close();
    conn.close();
    catch(Exception e) {
    e.printStackTrace(System.err);
    System Error: oracle.xml.sql.OracleXMLSQLException: Exception d'E/S: End of TNS data channel
    System Error: int oracle.xml.sql.dml.OracleXMLSave.saveXML(org.w3c.dom.Document, int) (OracleXMLSave.java:1928)
    System Error: int oracle.xml.sql.dml.OracleXMLSave.saveXML(java.net.URL, int) (OracleXMLSave.java:1880)
    System Error: int oracle.xml.sql.dml.OracleXMLSave.updateXML(java.net.URL) (OracleXMLSave.java:1329)
    System Error: void IFPBDJ.IFPCalculsExternes.XSUloadXMLToOracle(java.lang.String) (IFPCalculsExternes.java:125)
    System Error: void IFPBDJ.IFPCalculsExternes.main(java.lang.String[]) (IFPCalculsExternes.java:149)
    I AM KNOW CRYING...

Maybe you are looking for