Skip to main content


developerWorks  >  Information Management  >

Using the node type to solve problems with hierarchies in DB2 Universal Database

developerWorks

Level: Introductory

Jacques Roy (jacquesr@us.ibm.com), Technical Lead, IBM

26 Feb 2003

Get the downloads

This article describes a method for manipulating hierarchies in DB2 Universal Database through a user-defined node type. This method can greatly enhance performance and simplify developments for database applications that can benefit from a hierarchical data structure. Sample code included.

In this article

  • The problem with hierarchies

  • Nodes and hierarchies

  • Node vs. relational implementation

  • Implementing the node type

  • Indexing and SQL statements

  • Using the node data type

  • Solving hierarchical problems

  • Appendix: Function descriptions

Overview

The world is full of hierarchies. We see them everywhere. In data management, we talk about management hierarchies, bills-of-material, product classification, object hierarchies, XML, LDAP, and so on. It is a natural way to divide problems into smaller parts so they are more manageable.

Relational databases are not inherently very good at manipulating hierarchies. With the introduction of object-relational technology, it is now possible to extend the type of data and the operations available in the relational model to accommodate business problems that require types and operations that are not included in a relational database system. The user-defined type is one of those object-relational features that have been implemented in DB2 Universal Database for Windows, UNIX and Linux.

The node type is an implementation of a user-defined type. Together with its related opera-tions, the node type is useful in handling hierarchical structures. In this article, I describe the capabilities of this new type that is provided as sample code with this article.



Downloads

DescriptionNameSizeDownload method
Article in PDF format 0302roy.pdf65KBHTTP
Code sampleDB2Node.zip21KBHTTP
Information about download methodsGet Adobe® Reader®


Resources

Learn

Get products and technologies
  • Build your next development project with IBM trial software, available for download directly from developerWorks.


Discuss


About the author

Jacques Roy photo

Jacques Roy is a member of IBM's worldwide sales support organization. He has over 20 years of industry experience and over five years of experience with database extensibility. He is the author Informix Dynamic Server.2000: Server-Side Programming in C and co-author of Open-Source Components for the Informix Dynamic Server 9.x.




Rate this content


Please take a moment to complete this form to help us better serve you.



 


 


Not
useful
Extremely
useful
 


Back to top


Document options

Document options requiring JavaScript are not displayed

Sample code


Rate this content

Help us improve this content