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', ?, ?)
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 PreparedStatement or a CallableStatement?
The safest is to use a Statement, probably the most portable accross
JDBC Drivers.
vasilip - 05 Feb 2007 12:03 GMT
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..(<update 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
> 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
[quoted text clipped - 3 lines]
> The safest is to use a Statement, probably the most portable accross
> JDBC Drivers.