Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / February 2007

Tip: Looking for answers? Try searching our database.

DB2 XMLUPDATE error executing from Java Statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
vasilip - 05 Feb 2007 11:12 GMT
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 - 05 Feb 2007 11:40 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.