DB2 XMLUPDATE error executing from Java Statement

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vasilip

    #1

    DB2 XMLUPDATE error executing from Java Statement

    I am trying to use the XMLUPDATE stored procedure. Installed fine, and
    seems to work great if I execute the statement from a sql query using
    the controll center.. Doesn't work from java however. I get a 07004
    error that says I must in clude a USING or INTO clause in my dynamic
    query.

    I inserted the USING="SQL" clause (as the documentation stated
    somewhere) into the XML query but that didn't do anything.

    Can anyone help me with this? the query works fine on its own.. so I'm
    sure its not something really hard to correct.

    Thanks :)

    THE QUERY:

    CALL DB2XMLFUNCTIONS .XMLUPDATE(
    '<updates>
    <update using=\"SQL\" action=\"append \" col=\"1\" path=\"/WishList\">
    <Item>newEmail@ yahoo.com</Item>
    </update>
    </updates>',
    'select wishlist from users where users_id=1',
    'update users set wishlist=? where users_id=1', ?, ?)

  • Otto Carl Marte

    #2
    Re: DB2 XMLUPDATE error executing from Java Statement

    Most probably you have a syntax error in your query, it looks like DB2
    is trying to execute the "update using" segment of your XML as an
    UPDATE statement. Are you escaping special characters correctly in the
    Java?
    Are you using a Statement, a PreparedStateme nt or a CallableStateme nt?
    The safest is to use a Statement, probably the most portable accross
    JDBC Drivers.


    Comment

    • vasilip

      #3
      Re: DB2 XMLUPDATE error executing from Java Statement

      I tried using all three types, statement, prepared and callable. all
      result with the same error. the only thing I'm escaping is the
      quotations in the xml update string..(<updat e using=\"SQL\" action=
      \"append\" col=\"1\" path=\"/WishList\">
      ) It iss a static query since I'm just trying to get the thing to
      work to begin with.. so there is no chance of unescaped characters in
      the insterted information. I figured it might not be finding data to
      substitute the ?s for.. but that wouldn't be an issue in a normal
      statement..

      Vasili

      On Feb 5, 1:40 pm, "Otto Carl Marte" <Otto.Ma...@gma il.comwrote:
      Most probably you have a syntax error in your query, it looks like DB2
      is trying to execute the "update using" segment of your XML as an
      UPDATE statement. Are you escaping special characters correctly in the
      Java?
      Are you using a Statement, a PreparedStateme nt or a CallableStateme nt?
      The safest is to use a Statement, probably the most portable accross
      JDBC Drivers.

      Comment

      Working...