IBM Books

Application Development Guide


Why Use the DB2 Object Extensions?

One of the most important recent developments in modern programming language technology is object-orientation. Object-orientation is the notion that entities in the application domain can be modeled as independent objects that are related to one another by means of classification. Functions (methods) encapsulate the external behavior and characteristics of objects by hiding their internal implementation details. Object-orientation lets you capture the similarities and differences among objects in your application domain and group those objects together into related types. Objects of the same type behave in the same way because they share the same set of type-specific functions, reflecting the behavior of your objects in the application domain.

With the object extensions of DB2, you can incorporate object-oriented (OO) concepts and methodologies into your relational database by extending it with richer sets of types and functions. With these extensions, you can store instances of object-oriented data types in columns of tables, and operate on them by means of functions in SQL statements. In addition, you can make the semantic behavior of stored objects an important resource that can be shared among all your applications by means of the database.

To incorporate object-orientation into your relational database systems, you can define new types and functions of your own to reflect the semantics of the objects in your application domain. Some of the data objects you want to model may be large and complex (for example, text, voice, image, and financial data). Therefore, you may also need mechanisms for the storage and manipulation of large objects. User-defined Distinct types (UDTs), user-defined functions (UDFs), and Large Objects (LOBs) are the mechanisms provided by DB2 to fulfill these needs. With DB2, you can now define new types and functions of your own to store and manipulate application objects, potentially gigabytes in size, within the database.

UDTs, UDFs, and LOBs build the foundation for the DB2 object-relational extensions. In addition to UDTs, UDFs, and LOBs, DB2 also includes mechanisms that enable the representation of another important piece of the object semantics: the rules that govern the kinds of operations that are allowed on such objects in the application domain. These rules are embodied in the DB2 triggers and constraints mechanisms.

As described in subsequent sections, there is an important synergy among these object-oriented features. You can model a complex object in the application domain as a UDT. The UDT may in turn be internally represented as a LOB. The UDT's behavior may be implemented in terms of UDFs, and its integrity rules implemented in terms of constraints and triggers. This section shows you the steps required to define UDTs and UDFs, how to use LOBs, and how UDTs, UDFs, and LOBs can better represent the objects in your application and thus work together. Using Triggers in an Active DBMS shows you how triggers can enhance the semantics of your applications.

The use of the DB2 object-oriented mechanisms (UDTs, UDFs, LOBs, and triggers) is not restricted to the support of object-oriented applications. Just as C++, a popular object-oriented programming language, is used to implement all sorts of non-object-oriented applications, the object-oriented mechanisms provided by DB2 are also very useful to support all kinds of non-object-oriented applications. UDTs, UDFs, LOBs, triggers, and constraints are general-purpose mechanisms that can be used to model any database application. For this reason, these DB2 object extensions offer extensive support for both non-traditional, that is, object-oriented applications, in addition to improving support for traditional ones.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]