ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Database insert of xml through ESQL Message Broker

Post new topic  Reply to topic
 Database insert of xml through ESQL Message Broker « View previous topic :: View next topic » 
Author Message
MBExpert
PostPosted: Fri Jan 15, 2010 1:40 am    Post subject: Database insert of xml through ESQL Message Broker Reply with quote

Novice

Joined: 22 Aug 2007
Posts: 14

Hi,

I am using statement:

PASSTHRU ('INSERT INTO "<Schema>"."<TableName>" (Field1_Number , Field2_char , Field3_CLOB) Values (?,?,?)' ,1, 'Key1', OutputRoot.XML.Message.Data));

All fields are getting inserted, except the last one. ie OutputRoot.XML.Message.Data.

The Message (OutputRoot) looks like this:

<Message><Data name="abc" trace="2010-01-14 05:23:39.697326">
<Folder1 id="F001" name="Data1" trace="2010-01-14 05:23:39.697326">
<Folder2 id="F001-1" name="Data1 - Val1" trace="2010-01-14 05:23:39.697326">
<Folder3>
<Parameter name="P1">355</Parameter>
<Parameter name="P2">123</Parameter>
</Folder3>
</Folder2>
</Folder1>
</Data>
</Message>

The same code works for me if my xml does not have attributes.

I tried converting it to bitstream and then inserting as clob. I also tried using (XML.AsisElement) too.. But neither of them worked.

Any ideas?

Regards,
NK
Back to top
View user's profile Send private message
exerk
PostPosted: Fri Jan 15, 2010 2:15 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Moving it to the Broker forum...
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jan 15, 2010 3:08 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Are you sure your message domain is XML?

What did you parse the incoming message into? Could it me XMLNSC

If you are using the XML domain then please use another one as this parser is depreciated. Kimbert no doubt will recommend XMLNSC.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
constantlearner
PostPosted: Fri Jan 15, 2010 8:42 am    Post subject: Reply with quote

Newbie

Joined: 08 Jan 2010
Posts: 8

Check what is getting inserted in your table.

One of the reasons why proper data is not getting inserted when you insert the xml can be because of control characters in it. For e.g. after you insert if you see in your table something like "/n /n" etc then it means that the XML is not normalized.

I'm not sure on how to normalize an xml i.e. remove all the unwanted spaces or characters.

Is there any command to do this in ESQL?
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 15, 2010 8:49 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

constantlearner wrote:
Is there any command to do this in ESQL?


Use XMLNSC.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Fri Jan 15, 2010 9:18 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

constantlearner wrote:
Check what is getting inserted in your table.

One of the reasons why proper data is not getting inserted when you insert the xml can be because of control characters in it. For e.g. after you insert if you see in your table something like "/n /n" etc then it means that the XML is not normalized.

I'm not sure on how to normalize an xml i.e. remove all the unwanted spaces or characters.

Is there any command to do this in ESQL?


From the clue given in the PASSTHRU I'd guess that the targer field is a CLOB.
so your points about the spaces etc is incorrect.

The input Data is probably in a parsed form of XML. It does not matter which domain XML, XMLNS or XMLNSC.
This is incompatible with the type of data that has to be used when inserting into CLOB/BLOB fields.
You need to convert the parsed form of XML into a BLOB format.
There are many,many posts here about how to do this.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
constantlearner
PostPosted: Fri Jan 15, 2010 9:19 am    Post subject: Reply with quote

Newbie

Joined: 08 Jan 2010
Posts: 8

The XMLNSC may not solve the problem as the control characters will still be there inside the xml....
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Jan 15, 2010 9:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

constantlearner wrote:
The XMLNSC may not solve the problem as the control characters will still be there inside the xml....


It's not clear why a CLOB field would have any difficulties with legal characters, even if they are non-printable.

It's fairly straightforward to understand why it will not work to insert a logical message tree into a database column that is expecting a character bitstream.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Jan 15, 2010 9:51 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

constantlearner wrote:
The XMLNSC may not solve the problem as the control characters will still be there inside the xml....


No they won't.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Database insert of xml through ESQL Message Broker
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.