OODB
Database.
Object Oriented Databases
Object oriented databases are also
called Object Database Management Systems (ODBMS). Object databases store
objects rather than data such as integers, strings or real numbers. Objects
are used in object oriented languages such as Smalltalk, C++, Java, and
others. Objects basically consist of the following:
Therefore objects contain both
executable code and data. There are other characteristics of objects such as
whether methods or data can be accessed from outside the object. We don't
consider this here, to keep the definition simple and to apply it to what an
object database is. One other term worth mentioning is classes. Classes are
used in object oriented programming to define the data and methods the object
will contain. The class is like a template to the object. The class does not
itself contain data or methods but defines the data and methods contained in
the object. The class is used to create (instantiate) the object. Classes may
be used in object databases to recreate parts of the object that may not
actually be stored in the database. Methods may not be stored in the database
and may be recreated by using a class.
Comparison to Relational Databases
Relational databases store data in
tables that are two dimensional. The tables have rows and columns. Relational
database tables are "normalized" so data is not repeated more often
than necessary. All table columns depend on a primary key (a unique value in
the column) to identify the column. Once the specific column is identified,
data from one or more rows associated with that column may be obtained or
changed.
To put objects into relational
databases, they must be described in terms of simple string, integer, or real
number data. For instance in the case of an airplane. The wing may be placed
in one table with rows and columns describing its dimensions and
characteristics. The fusalage may be in another table, the propeller in
another table, tires, and so on.
Breaking complex information out
into simple data takes time and is labor intensive. Code must be written to
accomplish this task.
Object Persistence
With traditional databases, data
manipulated by the application is transient and data in the database is
persisted (Stored on a permanent storage device). In object databases, the
application can manipulate both transient and persisted data.
When to Use Object Databases
Object databases should be used
when there is complex data and/or complex data relationships. This includes a
many to many object relationship. Object databases should not be used when
there would be few join tables and there are large volumes of simple
transactional data.
Object databases work well with:
|
- CAS Applications (CASE-computer aided software
engineering, CAD-computer aided design, CAM-computer aided manufacture)
- Multimedia Applications
- Object projects that change over time.
- Commerce
Object Database Advantages over RDBMS
- Objects don't require assembly and disassembly saving
coding time and execution time to assemble or disassemble objects.
- Reduced paging
- Easier navigation
- Better concurrency control - A hierarchy of objects may
be locked.
- Data model is based on the real world.
- Works well for distributed architectures.
- Less code required when applications are object
oriented.
Object Database Disadvantages compared to RDBMS
- Lower efficiency when data is simple and relationships
are simple.
- Relational tables are simpler.
- Late binding may slow access speed.
- More user tools exist for RDBMS.
- Standards for RDBMS are more stable.
- Support for RDBMS is more certain and change is less
likely to be required.
ODBMS Standards
- Object Data Management Group
- Object Database Standard ODM6.2.0
- Object Query Language
- OQL support of SQL92
How Data is Stored
Two basic methods are
used to store objects by different database vendors.
- Each object has a unique ID and is defined as a
subclass of a base class, using inheritance to determine attributes.
- Virtual memory mapping is used for object storage and
management.
Data transfers are
either done on a per object basis or on a per page (normally 4K) basis.
XML
Database
is used
to store huge amount of information in the XML format. As the use of XML is
increasing in every field, it is required to have a secured place to store the
XML documents. The data stored in the database can be queried using XQuery,
serialized, and exported into a desired format.
XML Database Types
There are
two major types of XML databases −
- XML- enabled
- Native XML (NXD)
XML - Enabled Database
XML
enabled database is nothing but the extension provided for the conversion of
XML document. This is a relational database, where data is stored in tables
consisting of rows and columns. The tables contain set of records, which in
turn consist of fields.
Native
XML Database
Native
XML database is based on the container rather than table format. It can store
large amount of XML document and data. Native XML database is queried by
the XPath-expressions.
Native
XML database has an advantage over the XML-enabled database. It is highly
capable to store, query and maintain the XML document than XML-enabled
database.
Example
Following
example demonstrates XML database −
<?xml version = "1.0"?>
<contact-info>
<contact1>
<name>Tanmay Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 123-4567</phone>
</contact1>
<contact2>
<name>Manisha Patil</name>
<company>TutorialsPoint</company>
<phone>(011) 789-4567</phone>
</contact2>
</contact-info>
Here, a
table of contacts is created that holds the records of contacts (contact1 and
contact2), which in turn consists of three entities − name, company and phone.
No comments:
Post a Comment