If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > XML columns

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-23-11, 18:28
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
XML columns

The DB2 fundamentals states that XML columns are used to store documents as a hierarchial set of entities.

What exactly does "hierachial set of entities" mean in this context?
Reply With Quote
  #2 (permalink)  
Old 08-23-11, 19:51
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
As you know, XML is data hierarchy.

Before pureXML, XML document was shredded and stored in multiple tables.
With pure XML, the data is not shred but stored in the native XML format - ie data hierarchy is 'known' within the column itself and not by external relationships.

I guess that what it means.

Are you after something specific ?
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 08-24-11, 04:35
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
Quote:
Originally Posted by sathyaram_s View Post
As you know, XML is data hierarchy.

Before pureXML, XML document was shredded and stored in multiple tables.
With pure XML, the data is not shred but stored in the native XML format - ie data hierarchy is 'known' within the column itself and not by external relationships.

I guess that what it means.

Are you after something specific ?
that's a pretty excellent explanation.

Well done.
Reply With Quote
  #4 (permalink)  
Old 08-24-11, 05:49
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
A “hierarchical” structure is characteristic of XML, as opposed to relational or network structures that allow many-to-many and other more complex kinds of relationships between entities. If you want to understand the difference between hierarchical, relational, and network structures, I would suggest Google.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #5 (permalink)  
Old 08-24-11, 05:51
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
Quote:
Originally Posted by Marcus_A View Post
A “hierarchical” structure is characteristic of XML, as opposed to relational or network structures that allow many-to-many and other more complex kinds of relationships between entities. If you want to understand the difference between hierarchical, relational, and network structures, I would suggest Google.
Google, I have never heard of that.

sathyaram_s gave a perfect answer to the specific question. Thanks.
Reply With Quote
  #6 (permalink)  
Old 08-24-11, 06:52
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
You could say that a XML column can contain a tiny little codasyl-database.
Thats why SQL with embedded Xquery or Xquery with embedded SQL can become complex because you will have to redefine your definition of "result set".
Reply With Quote
  #7 (permalink)  
Old 08-24-11, 06:53
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
Quote:
Originally Posted by dr_te_z View Post
You could say that a XML column can contain a tiny little codasyl-database.
Thats why SQL with embedded Xquery or Xquery with embedded SQL can become complex because you will have to redefine your definition of "result set".
Thought provoking. Thanks.
Reply With Quote
  #8 (permalink)  
Old 08-24-11, 07:36
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Quote:
Originally Posted by Breako View Post
Google, I have never heard of that.
That is what I am beginning to suspect.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #9 (permalink)  
Old 08-24-11, 08:25
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
Quote:
Originally Posted by Marcus_A View Post
That is what I am beginning to suspect.
Google - It sounds like something a child would say
Reply With Quote
  #10 (permalink)  
Old 08-24-11, 12:35
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
Reply With Quote
  #11 (permalink)  
Old 08-24-11, 12:38
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
Thanks. But I think sathyaram_s is far better in this particular case.

Without XML columns, you do not get the opportunity to keep the hierarchial structure. You have to shred. This is the point of them.
Reply With Quote
  #12 (permalink)  
Old 08-24-11, 13:08
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by Breako View Post

Without XML columns, you do not get the opportunity to keep the hierarchial structure. You have to shred.
Not necessarily. You could store the XML data as character or CLOB, which would also preserve their structure.
Reply With Quote
  #13 (permalink)  
Old 08-25-11, 03:05
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
Reply With Quote
  #14 (permalink)  
Old 08-25-11, 04:23
Breako Breako is offline
Registered User
 
Join Date: Jan 2006
Posts: 119
Quote:
Originally Posted by n_i View Post
Not necessarily. You could store the XML data as character or CLOB, which would also preserve their structure.
Excellent point.

So let's pick this one out.

What does the XML column give you over the CLOB column? Some XMl specific functions I presume.

Note: this is why I posted the question in this forum. Because we can have an interesting discussion.
Reply With Quote
  #15 (permalink)  
Old 08-25-11, 05:21
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
To compare storing XML using CLOB, XML extender and XMLColuimn think Notepad, Excel and RDBMS.

With Notepad, you can store data (any seperator). All read-write and manipulation tasks have to be done externally.

With Excel you can store data in columns and sheets, access them using macros, do some checks etc. There is no meta data.

With RDBMS you can store the data in columns and tables, access them using SQL, more complex checks, ease of use, efficient access etc. There is meta data

Now storing XML as CLOB, using XML Extender or using XML columns is similar as above:

As CLOB, you can store XML but for the database it is a just a bunch of characters. You can access it, parse it, validate it all outside the database.

To make the task of storing and using XML as CLOB, there was a product called XML Extender. This provided a set of UDTs, UDFs and Stored Procs. Withing the database, data was stored as CLOB or relational tables. But the the UDTs and Routines helped to make it a bit more easier to store, access and validate and provided very little meta data capabilities (if you call it so). Access was in-efficient.

Using pureXML, when storing data in XML column the database understands XML (stores meta data internally), easy and efficient access, validation against XML Schemas, elements and attributes are indexable etc.

Hope this provides a comparison.
I am no expert in PureXML, so will let someone with more knowledge provide additional details.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On