Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update XML to CLOB

 
Mahesh Sivaraman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34680
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahesh,
If it's a Chinese character, it wouldn't be Ascii. Right?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64980
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
Mahesh Sivaraman
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34680
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahesh,
Thanks for updating your display name.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic