aspose file tools*
The moose likes JDBC and the fly likes Update XML to CLOB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Update XML to CLOB" Watch "Update XML to CLOB" New topic
Author

Update XML to CLOB

Mahesh Sivaraman
Greenhorn

Joined: Jun 19, 2002
Posts: 19
Hi,

I have an xml file in Oracle database's CLOB column. I am trying to fetch it, parse it using JDOM, and update one of the elements with Chinese characters which come from my web page. The database charset is AL32UTF8.

Following is the steps io follow.
1. Select data using getAsciiStream() of result set.
2. SAXBulder to build it.
3. Update one of the elements with Chinese.
4. Get the string using XMLOutputer.
5. Call getBytes of the string.
6. Update the Column using setAsciiStream of PreparedStatement.

But i always get error saying
"Invalid character encountered in: failAL32UTF8Conv"

What am i doing wrong ?
Anyhelp appreciated...

Thanx and regards
Mahesh
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30548
    
152

Mahesh,
If it's a Chinese character, it wouldn't be Ascii. Right?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

can I recommend you at least consider not putting XML in the database? Our experience was that since it is not easily searchable and loses the XML provided context that we had to go back and create an XML to table mapping. This also works well with automatic Object-Relational-XML layers and takes much of the effort away.

Dave
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61233
    
  66

"mahesh sr",

There aren't may rules that have been put into place here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mahesh Sivaraman
Greenhorn

Joined: Jun 19, 2002
Posts: 19
Originally posted by Jeanne Boyarsky:
Mahesh,
If it's a Chinese character, it wouldn't be Ascii. Right?


Yes its not ascii. In fact i tried using setCharacterStream and getCharacterStream methods also. The javadoc says, it reads as Unicode stream. Anyway i think i'll go with David's suggestion. If you get more info on this, please post it.

Thanx for your help

Regards
Mahesh
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30548
    
152

Mahesh,
Thanks for updating your display name.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Update XML to CLOB