Domain: cmu.edu
Stories and comments across the archive that link to cmu.edu.
Stories · 280
-
One Answer To Spam: Sell Your Interruption Time
An anonymous reader writes "A recent article in the IBM Systems Journal describes an innovative solution to curb both spam email and telemarketing. In short, the potential recipient of a message/call advertises the potential cost of contacting him uninvited. If the sender agrees to pay that cost, it acquires a token that it includes in the message/call and the message/call is accepted. The recipient decides to collect the fee or not, while recipients in a white list are not required to carry a token. The author also provides for a more detailed description." -
CA Supreme Court Saves LiViD, Pavlovich
joebeone writes "The California Supreme Court has suprisingly ruled that Matthew Pavlovich is not within their jurisdiction in the DVD-CCA's suit against his posting of DeCSS in relation to the development of the LiViD DVD player for open operating systems. What's surprising? It's surprising that they held that his posting of DeCSS was not actionable... (however the use of the program by users to circumvent CSS could be under the DMCA)." -
Master of Software Engineering: CMU or Elsewhere?
nestea247 asks: "I graduated from CMU 3 years ago and have since worked in a very good company and gained quite a lot of solid software development experiences. Now I'm thinking of moving on, to learn more about software engineering i.e. management/methods/processes. CMU has a very good program. I have been comparing it against other schools like MIT, Stanford, Berkeley...etc., and it seems like only CMU has very specific concentration on software engineering and a tailor-made cirriculum. Other schools are just general masters degree in CS that might require me to re-learn or polish a lot of concepts in undergrad. So CMU sounds like a good choice, but I hope if someone could tell me what's good about the other schools. What should I take into consideration (academically) when I select a grad school for MSE?" -
Holy Grail of Remote Controls
castilejw writes "CNN has an article showing where researchers at Carnegie Mellon University have teamed with researchers from Maya Designs, Inc. to produce the ultimate universal remote, which "would choreograph not just home entertainment systems but also intelligent appliances all around the house: microwave ovens, clothes dryers, air conditioners.". The device they have shown is a modified Compaq iPAQ, which they have so far modified to control two lamps, a fan and a stereo with a five-CD changer." Seems like that much is pretty easy. Now when it can control my answering machine, my MP3 collection, and my garage door, I'll be ready to automate my soul. Update: 09/02 15:34 GMT by CT : Oops, this is a duplicate. Move along :) We suck so much. Blah blah blah. -
CD Copy Stopper
CTho9305 writes "Technology Review has an article about a new CD and DVD copy protection system by Doc-Witness, where the disc itself has a smart card on it. The card checks if a request is valid, and then returns a key to decrypt the contents of the disc. It apparently works with standard drives." -
Turning Dead Drives into Speakers?
An anonymous reader writes "Why pay 500$ for Klipsch's latest speaker system? You can make something that looks way cooler for the price of a DIY amplifier and some HDDs out of a dumpster. It doesn't sound quite as good but who cares!" Next week we'll show you how to turn a laundry basket and a speak & spell into your own segway. -
Wanted: Home for Adventurous Robots
mr.crutch writes "According to an article by the Associated Press, Carnegie Mellon University is actively seeking at least 600 acres of abandoned land in Western Pennsylvania on which to test robots developed by the National Robotics Engineering Consortium. Land speculators may want to contact real estate agents in the Pittsburgh area to cash in!" -
Wanted: Home for Adventurous Robots
mr.crutch writes "According to an article by the Associated Press, Carnegie Mellon University is actively seeking at least 600 acres of abandoned land in Western Pennsylvania on which to test robots developed by the National Robotics Engineering Consortium. Land speculators may want to contact real estate agents in the Pittsburgh area to cash in!" -
Social Robot?
smashr writes "Researchers are currently putting the finishing touches on robots that will be attending the AAAI (American Association for Artificial Intelligence) conference this year as part of the AAAI robot challenge. In addition to robots wearing tuxedos and serving drinks, several robots designed to actually register themselves will be participating in the conference. One such robot is GRACE, being built by Carnegie Mellon University and the Naval Research Lab (among others). GRACE features a digital face and speech recognition to interact with people attending the conference. (She even runs Linux!) Her goal is to register for the conference, give a speech and answer questions. Stories at: Pittsburgh Post-Gazette, CNN.com, and USA Today." -
Apple Requires Three-Button Mouse for Shake 2.5
SpillerC writes "The requirements for the newest version of Shake (cross-platform: Mac OS X, Linux, Windows, Irix) will require a three-button mouse on the Mac. Are there any other Apple-produced applications (Apple owns Shake) that require a three-button mouse? Will Apple release its own three-button mouse now?" -
Government Funds Secret Sustainable Computing
SEWilco writes "OSDN's NewsForge reports that Carnegie Mellon University has started a Sustainable Computing Consortium to improve the quality and security of software. The only news release is that NASA gave CMU $23 million to help create dependable software. SCC members get an internal-use license for SCC software. So taxpayers are paying millions to create proprietary software, and companies get access for a few thousand dollars. (There is some blurring between CMU's SCC and CMU's High Dependability Computing Consortium, although HDCC's web site has been idle for a year.)" -
Font Company Wielding DMCA Against Bit-Flipping
Roundeye writes: "Seems that AGFA Monotype is trying to stop Tom Murphy from distributing his embed tool. According to the lawyers, the pair of bits in a TrueType font which specify how a font should be embedded constitute a DMCA-worthy access control device. Tom's standing up to them because, 'Embedding bits do nothing to keep consumers from copying fonts' and 'Since the enactment of the DMCA, I have only ever run embed on fonts for which I own the copyright." He's even got his own haiku version of the software..." -
Font Company Wielding DMCA Against Bit-Flipping
Roundeye writes: "Seems that AGFA Monotype is trying to stop Tom Murphy from distributing his embed tool. According to the lawyers, the pair of bits in a TrueType font which specify how a font should be embedded constitute a DMCA-worthy access control device. Tom's standing up to them because, 'Embedding bits do nothing to keep consumers from copying fonts' and 'Since the enactment of the DMCA, I have only ever run embed on fonts for which I own the copyright." He's even got his own haiku version of the software..." -
Font Company Wielding DMCA Against Bit-Flipping
Roundeye writes: "Seems that AGFA Monotype is trying to stop Tom Murphy from distributing his embed tool. According to the lawyers, the pair of bits in a TrueType font which specify how a font should be embedded constitute a DMCA-worthy access control device. Tom's standing up to them because, 'Embedding bits do nothing to keep consumers from copying fonts' and 'Since the enactment of the DMCA, I have only ever run embed on fonts for which I own the copyright." He's even got his own haiku version of the software..." -
Robocup 2002 World Robot Soccer Championships
dipfan writes "While the rest of the world is watching the soccer world championships in Korea and Japan this summer, at the same time the Robocup 2002 competition for soccer-playing robots is to take place there - the sixth time the tournament has been held, with 35 countries competing and this time including a "humanoid league" competition. The purpose is to foster research in robotics, with the aim of building a team of robots that can play and win against the best human teams by 2050. One of the pre-tournament favourites this year is Iran, who did well in 2000 but not in 2001. The Swedish team includes a star player named Priscilla, described as "looking like a sister of the Terminator". One of the Swedish designers comments: 'you don't want to give too much freedom to the robots as they will go crazy.' Much like flesh-and-blood highly-paid sports stars really." -
Scientology Uses DMCA to Delist Critic's Website
touretzky writes: "Scientology has used a DMCA threat to force removal of a large number of pages from xenu.net from the Google search engine. Some of the pages Scientology is objecting to contain no material owned by the cult; other pages are clearly covered under "fair use". Scientology's ongoing abuse of Google is documented here. Of course, the Norwegian owner of xenu.net could write a counternotification letter, but that would require him to agree to the jurisdiction of a US court in a district of Scientology's choosing." The posting by Heldal-Lund agrees with what we can observe at Google - the pages listed in the posting aren't in Google's database, though many others are. Update: 03/21 14:16 GMT by M : Paul Wouters of xtdnet.nl (which hosts xenu.net) submits this page documenting Scientology's attacks against the ISP for continuing to host xenu.net. -
Scientology Uses DMCA to Delist Critic's Website
touretzky writes: "Scientology has used a DMCA threat to force removal of a large number of pages from xenu.net from the Google search engine. Some of the pages Scientology is objecting to contain no material owned by the cult; other pages are clearly covered under "fair use". Scientology's ongoing abuse of Google is documented here. Of course, the Norwegian owner of xenu.net could write a counternotification letter, but that would require him to agree to the jurisdiction of a US court in a district of Scientology's choosing." The posting by Heldal-Lund agrees with what we can observe at Google - the pages listed in the posting aren't in Google's database, though many others are. Update: 03/21 14:16 GMT by M : Paul Wouters of xtdnet.nl (which hosts xenu.net) submits this page documenting Scientology's attacks against the ISP for continuing to host xenu.net. -
Hypernets -- Good (G)news for Gnutella
Red Roo writes: "This online article addresses the recent criticism of Gnutella network scalability by pointing out that it is a Cayley tree. As a viable candidate for massively scalable P2P bandwidth, all trees are dead! But by going to higher dimensional virtual networks (aka "hypernets") e.g., hypercubes or hypertori, near linear scalability can be achieved for P2P populations on the order of several million peers each with only 20 open connections. This concept seems to have been entirely overlooked by critics and developers alike." -
Harddrive Speakers
paranoidia writes "Ever get annoyed by the loud noise your harddrive makes? I bet you never thought of actually using that to your advantage. A friend here at CMU actually took 3 broken hard drives and got them to spin at certain frequencies outputed by his computer. So in the end, three harddrives are actually now speakers! There are videos and a few pictures with explanations onto how he did this wonderous thing." -
Carmack: Lord of the Games
seer writes: "This article on Red Herring is a nice look at the interworkings of id software, most specifically their famous employee John Carmack. It delves deeply into the fact that id has stayed a very small company and dabbles with other topics such as Carmack's tendency to stay away from Microsoft 'standards' and the whole DooM ]I[ debacle. An interesting read." -
History of Video Games
seer writes "There's a nice history of videogames over at GameSpot. It starts with pre-videogame activity in 1889 with the Marufuku Company (later Nintendo) and stretches to the recently released GameCube-DVD system." Hey, it's sunday. No reason to knock yourself out reading the works of ancient philosophers (unless you're taking Ancient Philosophers 230 and have an exam this week). -
Response To The USDOJ-Microsoft Settlement
icanoop writes: "I haven't heard much about whether or not people are taking advantage of the Tunney Act and commenting on the settlement. Here is my letter to the DOJ in pdf and html. Remember these are my opinions, I'm not trying to represent open source or anything. I hope it will inspire others to send comments to the DOJ." -
Response To The USDOJ-Microsoft Settlement
icanoop writes: "I haven't heard much about whether or not people are taking advantage of the Tunney Act and commenting on the settlement. Here is my letter to the DOJ in pdf and html. Remember these are my opinions, I'm not trying to represent open source or anything. I hope it will inspire others to send comments to the DOJ." -
Response To The USDOJ-Microsoft Settlement
icanoop writes: "I haven't heard much about whether or not people are taking advantage of the Tunney Act and commenting on the settlement. Here is my letter to the DOJ in pdf and html. Remember these are my opinions, I'm not trying to represent open source or anything. I hope it will inspire others to send comments to the DOJ." -
All Work And No Play ...
Clifton Forlines writes: "Jupiter Media Metrix released a report on Monday about PC gaming - here's one of the more interesting tidbits: 'Similar to past years, Microsoft Windows-bundled games dominated the top rankings in October 2001: Solitaire was number one, with 21.3 million users.' A little math tells us that americans spent about 24 million man-hours in October on Solitarie (estimating that each user spent a little more than an hour over the whole month) That corresponds to about 1 million man-days, or around 2740 man-years! For comparison, I looked up these numbers... Empire State Building: 7 million man-hours (a mere 9 days of Solitaire), Panama Canal: 20 million man-hours (a mere 26 days of Solitaire), Apollo project: 15.5 billion man-hours (or a mere 52 years of Solitaire) Think about it!" -
Open Spectrum: Free the Airwaves
akb writes: "Most of the RF spectrum in use is licensed for exclusive use. What do we get? Inefficient use through spectrum hoarding, political finagling to abuse the regulatory system to gain competitive advantage and access to the airwaves for only a few players. A good article over at CNET picks up on the example of 802.11b in using spread spectrum technology and unlicensed bands and proposes that model be applied to the rest of the spectrum. For the hardcore check out NYU law professor Yochai Benkler's writings, particularly this article (pdf) and Durga Satapathy's papers for the tech end of things." -
What Makes a City Appealing to High-Tech Workers?
WGR writes "The City of Ottawa, Canada is starting to re-write its Official Plan, the "charter" for a city. [A few weeks ago] we had a 5 day Smart Growth Summit that was webcast online with discussion groups and web interactivity. Ottawa is fairly strong in the high-tech sector as it is, with NortelNetworks and JDS-Uniphase having their biggest presence here and had over a $1 billion of venture capital last year. But how do you keep a livable city when you expect to have a 50% population increase in 10 years? One idea came from Dr. Richard Florida from Carnegie-Mellon University. He said that "knowledge workers" want to go to places that have the 3 T's, "Technology, Talent and Tolerance". That is, where there already is a lot of technology, where there is a rich artistic and entertainment sector, lots of educational opportunities, where there are a lot of people with similar interests and where there are people from many diverse backgrounds and lifestyles. But not necessarily low city taxes. Do you agree, and what would be your ideal city to work in?" -
RoboCup 2001 Underway
Dan B writes: "RoboCup 2001, the fifth international competition, is underway. The competition is held from August 2nd through the 10th at the Washington State Convention and Trade Center in Seattle, Washington, USA. International teams compete their autonomous soccer-playing robots in three different leagues including Sony Legged League (remember the cute puppies?). The competition is open to the public, so if you happen to be near Seattle, check it out." -
RoboCup 2001 Underway
Dan B writes: "RoboCup 2001, the fifth international competition, is underway. The competition is held from August 2nd through the 10th at the Washington State Convention and Trade Center in Seattle, Washington, USA. International teams compete their autonomous soccer-playing robots in three different leagues including Sony Legged League (remember the cute puppies?). The competition is open to the public, so if you happen to be near Seattle, check it out." -
'Free Sklyarov' Protests Scheduled
After the arrest of Dmitri Sklyarov, the EFF has been busy organizing protests for next Monday - check to see if there's one near you. A Las Vegas TV station apparently managed to interview him, though I can't get their video feed to work for me. The free-sklyarov mailing list has been set up to, well, you can probably guess. Read their archives before jumping in. And website BoycottAdobe.org is an easy URL to remember. Alan Cox has resigned from the Usenix committee which organizes the annual Linux Showcase, citing concerns about DMCA enforcement in the United States. And finally, Professor Touretzky has built on his DeCSS Gallery with a Gallery of Adobe Remedies for showcasing methods to remove restrictions on PDF files. -
'Free Sklyarov' Protests Scheduled
After the arrest of Dmitri Sklyarov, the EFF has been busy organizing protests for next Monday - check to see if there's one near you. A Las Vegas TV station apparently managed to interview him, though I can't get their video feed to work for me. The free-sklyarov mailing list has been set up to, well, you can probably guess. Read their archives before jumping in. And website BoycottAdobe.org is an easy URL to remember. Alan Cox has resigned from the Usenix committee which organizes the annual Linux Showcase, citing concerns about DMCA enforcement in the United States. And finally, Professor Touretzky has built on his DeCSS Gallery with a Gallery of Adobe Remedies for showcasing methods to remove restrictions on PDF files. -
RMS Says Free Software Is Good
A few city blocks and many philosophical lightyears away from the New York University auditorium where Microsoft Senior Vice President Craig Mundie extolled the virtues of proprietary software a few weeks ago, Richard M. Stallman spoke this morning instead on the reasons that software developers, CEOs and every citizen whatsoever should prefer the Free software movement's methods and results. Stallman, founder of the GNU Project and the Free Software Foundation, said a lot of things that he's been saying since 1984, but also threw in some zingers aimed at Microsoft's recent public criticism of open development models. Update: 05/30 01:56 PM by T : Correction: I incorrectly reported in the story below that David Touretzky of CMU introduced Richard Stallman at this speech; in fact, it was Mike Uretsky, Administrative Director of NYU's Center For Advanced Technologies (CAT) and professor in the Stern School of Business; the text below reflects this. With many apologies to both professors and to readers, timothy. (Read more.)NYU Information Systems chairman Mike Uretsky and NYU computer science professor Edmond Schonberg briefly introduced Stallman to a standing-room-only crowd at NYU's Courant Mathematical Institute.
Stallman drew laughter and applause during Uretsky's introduction by calling out "I do Free software, Open Source is a different crowd" when Uretsky made a reference to Open Source software. Rather than a point-by-point rebuttal of Mundie's speech advocating Microsoft's current "shared source" initiative, Stallman's speech presented both an overview of the Free software movement -- several times emphasizing how it differs from the more pragmatic Open Source movement -- and a defense of Free software at several levels. Though peppered with jokes and historical asides, the bulk of Stallman's talk was devoted to explaining the benefits of Free software and comparing community-based, non-proprietary software development to the "deliberately inflicted waste" of proprietary software.
The publicity that Mundie's speech has stirred up around software licensing is obviously not forgotten, though. Stallman began by saying "I'd like to thank Microsoft for providng me the opportunity to use this platform. For the last few weeks I've felt like an author whose book was fortuitously banned somewhere, but all the articles about it are giving the wrong author's name, because Microsoft describes our license as an 'Open Source' license." Stallman emphasized at several points that the approach he and GNU project have is at its core philosophical, not merely pragmatic.
Beginning with cooking rather than computers, Stallman pointed out the advantages of being able to share functional documents in the form of recipes. He pointed that while nearly everyone cooks, "unless you're great, you probably use recipes. You've probably had the experience of getting a recipe from a friend -- and unless you're a total neophyte, you probably have also had the experience of changing the recipe. If you've made changes and you make it for your friends, and they like it, you can write down your changes for them." Imagine, he said, if recipes were packaged in black boxes, unavailable for inspection.
Stallman named the qualities he uses to define Free software. He began with "freedom zero" -- the freedom to run the software for any purpose -- noting, "If you're not even free to run the software for anything you want, it's a pretty damn restrictive license."
He went on to describe three additional freedoms which distinguish Free from proprietary software: the right to change software to suit user needs; to redistribute the software; and to publish improved versions.
These freedoms are absent in proprietary software, Stallman said, and cited what he said was his first taste to the evils of non-disclosure statements, which took place while he was working as an operating system developer at MIT's Artificial Intelligence Laboratory.
Stallman knew of a computer scientist at Carnegie-Mellon University with a copy of the Xerox source, and asked for a copy in order to add this feature. He found his request was denied, because his fellow academic had signed a non-disclosure agreement.
"He had refused to cooperate with just about the the entire population of the planet Earth, because he had signed an non-disclosure agreement. This was my first encounter with a non-disclosure agreement, and I was the victim -- my lab and I were the victims. The lesson it taught me is that NDAs have victims, they aren't harmless."
Toward the close of his speech, Stallman pointedly applied the advantages of Free software to businesses, giving examples of ways in which a community of more than 100,000 developers leads to more robust and maintainable software, all issues of price aside.
Describing his experiences after releasing GNU-Emacs in 1984, Stallman said "I got a msg that said 'I think I saw a bug, and here's a fix.'" Others emailed him with new feature requests and bug reports, and in many cases, the code to implement an improved version, "until they were pouring in on my so fast that just making use of the information I was getting was a big job. Microsoft doesn't have this problem."
The iterative, inclusive software development process resulted in constantly improving code for the GNU Project's various pieces of software, said Stallman. "What people began to note around 1990 was that our SW was better -- it was more powerful than the proprietary alternatives."
Since that time (before the Linux kernel was developed and employed alongside many GNU utilities), Free and Open Source software has increased dramatically in use and public acceptance.
Citing the large number of companies now paying to develop Free software, and that the majority of pages on the World Wide Web are served with Apache running on GNU/Linux systems, Stallman scoffed at claims that the GPL was unfriendly to business. "Microsoft says that busineses can't get along with the GPL. So if businesses don't include IBM, and HP, and Sun, then maybe they're right."
Addressing one persistent myth, Stallman said "It's not true, sometimes I wish it was true, that if a company uses GPL in any project, that the whole project has to be GPLd. If programs operate at arms' length from each other, then they're legally separate, in general."
Again, though, Stallman was careful to point out that the advantages and intent of Free software had more to do with ethics and social good in a variety of fields than any particular bottom line. Closed software, he said, "causes psychosocial harm which affects the spirit of scientific cooperation. Progress in science crucially depends on people being able to work together. Nowadays you see scientists act as if they're in gangs at war with other little gangs of scientists ... we're all held back." And not just scientists -- of anyone who uses computers in the workplace, Stallman said that in the absence of a broad right to modify and improve the software they use, "Their lives and jobs are going to be frustrating -- people protect themselves from frustration by deciding not to care. When this happens, it's bad for those people and for society as a whole."
-
Recommendations for Neural Network Modeling Software?
iconian asks: "I'm looking for a freeware or a low-cost neural network modeling software to do some academic research and perhaps also to teach an undergraduate course. I need something that is not difficult to use and doesn't require an extensive programming background. I've tried PDP++ and I've found it to be very powerful but a bit overwhelming because of the programming needed to perform seemingly minor tasks. Right now, I'm trying out SNNS with the Java GUI but the interface is not as intuitive as PDP++ and documentation is a bit sparse. Do you guys have any suggestions?" -
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Why Aren't You Using An OODMS?
Dare Obasanjo contributed this piece about a subject that probably only a very few people have ever taken the time to consider, or had to. Below he asks the musical question "Why aren't you using an Object Oriented Database Management System?"Update: 05/04 02:11 PM by H :This is also running on K5 - yes, that's on purpose, and yes, Dare, myself and Rusty all know. *grin*
Why Aren't You Using An Object Oriented Database Management System?
In today's world, Client-Server applications that rely on a database on the server as a data store while servicing requests from multiple clients are quite commonplace. Most of these applications use a Relational Database Management System (RDBMS) as their data store while using an object oriented programming language for development. This causes a certain inefficency as objects must be mapped to tuples in the database and vice versa instead of the data being stored in a way that is consistent with the programming model. The "impedance mismatch" caused by having to map objects to tables and vice versa has long been accepted as a necessary performance penalty. This paper is aimed at seeking out an alternative that avoids this penalty.
What follows is a condensed version of the following paper; An Exploration of Object Oriented Database Management Systems, which I wrote as part of my independent study project under Dr. Sham Navathe.Introduction
The purpose of this paper is to provide answers to the following questions
- What is an Object Oriented Database Management System (OODBMS)?
- Is an OODBMS a viable alternative to an RDBMS?
- What are the tradeoffs and benefits of using an OODBMS over an RDBMS?
- What does code that interacts with an OODBMS look like?
An OODBMS is the result of combining object oriented programming principles with database management principles. Object oriented programming concepts such as encapsulation, polymorphism and inheritance are enforced as well as database management concepts such as the ACID properties (Atomicity, Consistency, Isolation and Durability) which lead to system integrity, support for an ad hoc query language and secondary storage management systems which allow for managing very large amounts of data. The Object Oriented Database Manifesto [Atk 89] specifically lists the following features as mandatory for a system to support before it can be called an OODBMS; Complex objects, Object identity, Encapsulation , Types and Classes ,Class or Type Hierarchies, Overriding,overloading and late binding, Computational completeness , Extensibility, Persistence , Secondary storage management, Concurrency, Recovery and an Ad Hoc Query Facility.
>From the aforementioned description, an OODBMS should be able to store objects that are nearly indistinguishable from the kind of objects supported by the target programming language with as little limitation as possible. Persistent objects should belong to a class and can have one or more atomic types or other objects as attributes. The normal rules of inheritance should apply with all their benefits including polymorphism, overridding inherited methods and dynamic binding. Each object has an object identifier (OID) which used as a way of uniquely identifying a particuler object. OIDs are permanent, system generated and not based on any of the member data within the object. OIDs make storing references to other objects in the database simpler but may cause referential intergrity problems if an object is deleted while other objects still have references to its OID. An OODBMS is thus a full scale object oriented development environment as well as a database management system. Features that are common in the RDBMS world such as transactions, the ability to handle large amounts of data, indexes, deadlock detection, backup and restoration features and data recovery mechanisms also exist in the OODBMS world.
A primary feature of an OODBMS is that accessing objects in the database is done in a transparent manner such that interaction with persistent objects is no different from interacting with in-memory objects. This is very different from using an RDBMSs in that there is no need to interact via a query sub-language like SQL nor is there a reason to use a Call Level Interface such as ODBC, ADO or JDBC. Database operations typically involve obtaining a database root from the the OODBMS which is usually a data structure like a graph, vector, hash table, or set and traversing it to obtain objects to create, update or delete from the database. When a client requests an object from the database, the object is transferred from the database into the application's cache where it can be used either as a transient value that is disconnected from its representation in the database (updates to the cached object do not affect the object in the database) or it can be used as a mirror of the version in the database in that updates to the object are reflected in the database and changes to object in the database require that the object is refetched from the OODBMS.
Comparisons of OODBMSs to RDBMSsThere are concepts in the relational database model that are similar to those in the object database model. A relation or table in a relational database can be considered to be analogous to a class in an object database. A tuple is similar to an instance of a class but is different in that it has attributes but no behaviors. A column in a tuple is similar to a class attribute except that a column can hold only primitive data types while a class attribute can hold data of any type. Finally classes have methods which are computationally complete (meaning that general purpose control and computational structures are provided [McF 99]) while relational databases typically do not have computationally complete programming capabilities although some stored procedure languages come close.
Below is a list of advantages and disadvantages of using an OODBMS over an RDBMS with an object oriented programming language.
Advantages- Composite Objects and Relationships: Objects in an OODBMS can store an arbitrary number of atomic types as well as other objects. It is thus possible to
have a large class which holds many medium sized classes which themselves hold many smaller classes, ad infinitum. In a relational database this
has to be done either by having one huge table with lots of null fields or via a number of smaller, normalized tables which are linked via
foreign keys. Having lots of smaller tables is still a problem since a join has to be performed every time one wants to query data based on the
"Has-a" relationship between the entities. Also an object is a better model of the real world entity than the relational tuples with regards to complex
objects. The fact that an OODBMS is better suited to handling complex,interrelated data than an RDBMS means that an OODBMS can outperform an RDBMS by ten to
a thousand times depending on the complexity of the data being handled.
- Class Hierarchy: Data in the real world is usually has hierarchical characteristics. The ever popular Employee example used in most RDBMS texts is
easier to describe in an OODBMS than in an RDBMS. An Employee can be a Manager or not, this is usually done in an RDBMS by having a type identifier
field or creating another table which uses foreign keys to indicate the relationship between Managers and Employees. In an OODBMS, the Employee class is
simply a parent class of the Manager class.
- Circumventing the Need for a Query Language: A query language is not necessary for accessing data from an OODBMS unlike an RDBMS since interaction
with the database is done by transparently accessing objects. It is still possible to use queries in an OODBMS however.
- No Impedence Mismatch: In a typical application that uses an object oriented programming language and an RDBMS, a signifcant amount of time is usually
spent mapping tables to objects and back. There are also various problems that can occur when the atomic types in the database do not map cleanly to
the atomic types in the programming language and vice versa. This "impedance mismatch" is completely avoided when using an OODBMS.
- No Primary Keys: The user of an RDBMS has to worry about uniquely identifying tuples by their values and making sure that no two tuples have the same
primary key values to avoid error conditions. In an OODBMS, the unique identification of objects is done behind the scenes via OIDs and is completely
invisible to the user. Thus there is no limitation on the values that can be stored in an object.
- One Data Model: A data model typically should model entities and their relationships, constraints and operations that change the states of the data in
the system. With an RDBMS it is not possible to model the dynamic operations or rules that change the state of the data in the system because this is
beyond the scope of the database. Thus applications that use RDBMS systems usually have an Entity Relationship diagram to model the static parts of the
system and a seperate model for the operations and behaviors of entities in the application. With an OODBMS there is no disconnect between the database
model and the application model because the entities are just other objects in the system. An entire application can thus be comprehensively modelled in one
UML diagram.
- Schema Changes: In an RDBMS modifying the database schema either by creating, updating or deleting tables is typically independent of the actual
application. In an OODBMS based application modifying the schema by creating, updating or modifying a persistent class typically means that changes have to
be made to the other classes in the application that interact with instances of that class. This typically means that all schema changes in an OODBMS will
involve a system wide recompile. Also updating all the instance objects within the database can take an extended period of time depending on the size of
the database.
The following information was gleaned from the ODBMS Facts website.
- The Chicago Stock Exchange manages stock trades via a Versant ODBMS.
- Radio Computing Services is the world's largest radio software company. Its product, Selector, automates the needs of the entire radio station -- from
the music library, to the newsroom, to the sales department. RCS uses the POET ODBMS because it enabled RCS to integrate and organize various elements,
regardless of data types, in a single program environment.
- The Objectivity/DB ODBMS is used as a data repository for system component naming, satellite mission planning data, and orbital management data deployed by Motorola in The Iridium System.
- The ObjectStore ODBMS is used in SouthWest Airline's Home Gate to provide self-service to travelers through the Internet.
- Ajou University Medical Center in South Korea uses InterSystems' Cachè ODBMS to support all hospital functions including mission-critical departments such as pathology, laboratory, blood bank, pharmacy, and X-ray.
- The Large Hadron Collider at CERN in Switzerland uses an Objectivity DB. The database is currently being tested in the hundreds of terabytes at data rates up to 35 MB/second.
- As of November, 2000, the Stanford Linear Accelerator Center (SLAC) stored 169 terabytes of production data using Objectivity/DB. The production data is distributed across several hundred processing nodes and over 30 on-line servers.
Below are Java code samples for accessing a relational database and accessing an object database. Compare the size of the code in both examples. The examples are for an instant messaging application.
- Validating a user.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
//start database session
Session session = Session.create(null, null);
session.join();
//open database and start transaction
Database db = Database.open("IMdatabase", ObjectStore.UPDATE);
Transaction tr = Transaction.begin(ObjectStore.READONLY);
//get hashtable of user objects from DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//get user object from database and see if it exists and whether password is correct
UserObject user = (UserObject) users.get(username);
if(user == null)
System.out.println("Non-existent user");
else
if(user.getPassword().equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
//end transaction, close database and retain terminate session
tr.commit();
db.close();
session.termnate();
}
//exception handling would go here ...
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
//Launch instance of database driver.
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
//create database connection
Connection conn = DriverManager.getConnection("jdbc:db2:IMdatabase");
//get password and username from user
String username = getUserNameFromUser();
String passwd = getPasswordFromUser();
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT password from user_table WHERE username='" + username +"'");
if(rset.next()){
if(rset.getString(1).equals(passwd))
System.out.println("Successful login");
else
System.out.println("Invalid Password");
}else{
System.out.println("Non-existent user");
}
//close database connection
sqlQry.close();
conn.close();
}
//exception handling would go here ...
There isn't much difference in the above examples although it does seem a lot clearer to perform operations on a UserObject instead of a ResultSet when validating the user.
- Getting the user's contact list.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try {
/* start session and open DB, same as in section 1a */
//get hashmap of users from the DB
OSHashMap users = (OSHashMap) db.getRoot("IMusers");
//get user object from database
UserObject c4l = (UserObject) users.get("Carnage4Life");
UserObject[] contactList = c4l.getContactList();
System.out.println("This are the people on Carnage4Life's contact list");
for(int i=0; i <contactList.length; i++)
System.out.println(contactList[i].toString()); //toString() prints fullname, username, online status and webpage URL
/* close session and close DB, same as in section 1a */
}//exception handling code
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try {
/* open DB connection, same as in section 1b */
//perform SQL query
Statement sqlQry = conn.createStatement();
ResultSet rset = sqlQry.executeQuery("SELECT fname, lname, user_name, online_status, webpage FROM contact_list, user_table" + "WHERE contact_list.owner_name='Carnage4Life' and contact_list.buddy_name=user_table.user_name");
System.out.println("This are the people on Carnage4Life's contact list");
while(rset.next())
System.out.println("Full Name:" + rset.getString(1) + " " + rset.getString(2) + " User Name:" + rset.getString(3) + " OnlineStatus:" + rset.getString(4) + " HomePage URL:" + rset.getString(5));
/* close DB connection, same as in section 1b*/
}//exception handling code
The benefits of using an OODBMS over an RDBMS in Java slowly becomes obvious. Consider also that if the data from the select needs to be returned to another method then all the data from the result set has to be mapped to another object (UserObject).
- Get all the users that are online.
Java code accessing an ObjectStore(TM) database
import COM.odi.*;
import COM.odi.util.query.*;
import COM.odi.util.*;
import java.util.*;
try{
/* same as above */
//use a OODBMS query to locate all the users whose status is 'online'
Query q = new Query (UserObject.class, "onlineStatus.equals(\"online\"");
Collection users = db.getRoot("IMusers");
Set onlineUsers = q.select(users);
Iterator iter = onlineUsers.iterator();
// iterate over the results
while ( iter.hasNext() )
{
UserObject user = (UserObject) iter.next();
// send each person some announcement
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Java JDBC code accessing an IBM's DB2 Database(TM)
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
import java.util.*;
try{
/* same as above */
//perform SQL query
Statement sqlQry = conn.createStatement
();
ResultSet rset = sqlQry.executeQuery
("SELECT fname, lname, user_name, online_status,
webpage FROM user_table WHERE
online_status='online'");
while(rset.next()){
UserObject user = new UserObject
(rset.getString(1),rset.getString
(2),rset.getString(3),rset.getString
(4),rset.getString(5));
sendAnnouncement(user);
}
/* same as above */
}//exception handling goes here
Proprietary- Object Store
- O2
- Gemstone
- Versant
- Ontos
- DB/Explorer ODBMS
- Ontos
- Poet
- Objectivity/DB
- EyeDB
Open Source - Ozone
- Zope
- FramerD
- XL2
The gains from using an OODBMS while developing an application using an OO programming language are many. The savings in development time by not having to worry about separate data models as well as the fact that there is less code to write due to the lack of impedance mismatch is very attractive. In my opinion, there is little reason to pick an RDBMS over an OODBMS system for newapplication development unless there are legacy issues that have to be dealt with.
-
Slashback: Reviews, Resources, Pogo
As usual, updates and tangents from previous stories in tonight's Slashback. Read on for more on toys from Pittsburgh, the newest iteration of the Magician-named distro, open source directory entries, and everyone's favorite trademark dispute. So hit the button.For better, for worse, for what it's worth. Thanks to the people who pointed out reviews of Mandrake 8.0 after I complained about a dearth of these when posting a couple of other reviews
Chris "soup" Campbell, for instance, points to his 8.0 review at Binary Freedom, and the_rev_matt writes: "Timothy was bemoaning the lack of Mandrake 8.0 reviews, so here is one." There's also a pctalk.org review discussed at the excellent Mandrakeforum site, as well as quite a few harsher comments when the release was announced. (I wish other distros would put comments in a forum like this, too.)
You know, 'bouncy bouncy'! Illah Nourbakhsh of CMU's CS lab (the same folks who brought your the Palm Pilot robot kit) writes: "... So here is the newest thing we've done. We make one-legged hopping robots that use an unusual spring system. We wondered what would happen if we scale the hopping robot up so it's much larger than 6 inches-- big enough to carry a human being. Then we can throw away the computer and the human can do the control. The result, the BowGo, enables ordinary humans to jump very, very high into the air and over obstacles. It is a far more powerful Pogo stick. http://www.cs.cmu.edu/~bowgo - there are both pictures and videos available from there. This is from the Toy Robots Initiative at Carnegie Mellon University."
Please give these people your venture capital, because I want to ride one of these! Mountain pogo-ing looks fun.
How can a jump rope be "open"? An unnamed reader contributes: "I've kept my eye on the guys over at the open source directory since I saw them take a good tongue lashing on /. a few weeks ago. They aren't doing too bad getting some listings, but the ones they have gotten seem to be making some waves. By my math, it looks like they've somehow gotten *two* new open source licenses passed through the boys at OSI (open source initiative) since they started three weeks ago."
Well, my tongue is out of lashing practice, but queries for "nano," "bluefish," "gimp" and "python" all return zero matches, so it doesn't seem like the first place I would go "to find Open-Source applications that are stable." The site still looks like a good idea, but is it eclipsed by existing resources? Maybe if enough people go visit it and add entries ...
A high-security remote terminal app by any other name nodvin writes: "In a Slashdot story on Mar. 22, 2001, it was stated Secure Shell Will Remain 'SSH'. However, the draft documents
now start with the title "draft-ietf-secsh-" rather than "draft-ietf-ssh". The charter is now found at: http://www.ietf.org/html.charters/secsh-charter.ht ml and the mail archive is now at:
ftp://ftp.ietf.org/ietf-mail-archive/secsh/ "Say it ain't so.
-
Slashback: Reviews, Resources, Pogo
As usual, updates and tangents from previous stories in tonight's Slashback. Read on for more on toys from Pittsburgh, the newest iteration of the Magician-named distro, open source directory entries, and everyone's favorite trademark dispute. So hit the button.For better, for worse, for what it's worth. Thanks to the people who pointed out reviews of Mandrake 8.0 after I complained about a dearth of these when posting a couple of other reviews
Chris "soup" Campbell, for instance, points to his 8.0 review at Binary Freedom, and the_rev_matt writes: "Timothy was bemoaning the lack of Mandrake 8.0 reviews, so here is one." There's also a pctalk.org review discussed at the excellent Mandrakeforum site, as well as quite a few harsher comments when the release was announced. (I wish other distros would put comments in a forum like this, too.)
You know, 'bouncy bouncy'! Illah Nourbakhsh of CMU's CS lab (the same folks who brought your the Palm Pilot robot kit) writes: "... So here is the newest thing we've done. We make one-legged hopping robots that use an unusual spring system. We wondered what would happen if we scale the hopping robot up so it's much larger than 6 inches-- big enough to carry a human being. Then we can throw away the computer and the human can do the control. The result, the BowGo, enables ordinary humans to jump very, very high into the air and over obstacles. It is a far more powerful Pogo stick. http://www.cs.cmu.edu/~bowgo - there are both pictures and videos available from there. This is from the Toy Robots Initiative at Carnegie Mellon University."
Please give these people your venture capital, because I want to ride one of these! Mountain pogo-ing looks fun.
How can a jump rope be "open"? An unnamed reader contributes: "I've kept my eye on the guys over at the open source directory since I saw them take a good tongue lashing on /. a few weeks ago. They aren't doing too bad getting some listings, but the ones they have gotten seem to be making some waves. By my math, it looks like they've somehow gotten *two* new open source licenses passed through the boys at OSI (open source initiative) since they started three weeks ago."
Well, my tongue is out of lashing practice, but queries for "nano," "bluefish," "gimp" and "python" all return zero matches, so it doesn't seem like the first place I would go "to find Open-Source applications that are stable." The site still looks like a good idea, but is it eclipsed by existing resources? Maybe if enough people go visit it and add entries ...
A high-security remote terminal app by any other name nodvin writes: "In a Slashdot story on Mar. 22, 2001, it was stated Secure Shell Will Remain 'SSH'. However, the draft documents
now start with the title "draft-ietf-secsh-" rather than "draft-ietf-ssh". The charter is now found at: http://www.ietf.org/html.charters/secsh-charter.ht ml and the mail archive is now at:
ftp://ftp.ietf.org/ietf-mail-archive/secsh/ "Say it ain't so.
-
SDMI Researchers Cancel Presentation After RIAA Threat
John Langford sent in the statement read by Dr. Edward Felten, a professor at Princeton University, who decided to skip presenting the paper he co-authored at a scientific conference due to legal threats made by the RIAA. The RIAA put out an open challenge in September 2000, requesting that researchers attack and crack the SDMI watermarking scheme, but demanded that anyone who researched the scheme suppress their results in order to be eligible for a cash prize. "Show off your skills", they said, but they didn't mean it. Felten and colleagues declined the cash prize and its accompanying restrictions, but have been threatened anyway - the RIAA would have brought a lawsuit claiming the research paper is a circumvention device forbidden by the DMCA, much like the DeCSS case.Statement read by Edward W. Felten
Fourth International Information Hiding Workshop
Pittsburgh, PA
April 26, 2001
"On behalf of the authors of the paper "Reading Between the Lines: Lessons from the SDMI Challenge," I am disappointed to tell you that we will not be presenting our paper today.Our paper was submitted via the normal academic peer-review process. The reviewers, who were chosen for their scientific reputations and credentials, enthusiastically recommended the paper for publication, due to their judgment of the paper's scientific merit.
Nevertheless, the Recording Industry Association of America, the SDMI Foundation, and the Verance Corporation threatened to bring a lawsuit if we proceeded with our presentation or the publication of our paper. Threats were made against the authors, against the conference organizers, and against their respective employers.
Litigation is costly, time-consuming, and uncertain, regardless of the merits of the other side's case. Ultimately we, the authors, reached a collective decision not to expose ourselves, our employers, and the conference organizers to litigation at this time.
We remain committed to free speech and to the value of scientific debate to our country and the world. We believe that people benefit from learning the truth about the products they are asked to buy. We will continue to fight for these values, and for the right to publish our paper.
We look forward to the day when we can present the results of our research to you, our colleagues, through the normal scientific publication process, so that you can judge our work for yourselves."
-
"Network Indifference" in the Free Unixes?
PapaZit asks: "Laptop and home users don't alway have access to a network. There are many tasks that can be done off-line, but require an occasional network connection (reading and responding to email, for example). In the Free Unix front, there has been some work in this direction, but it hasn't made it anywhere outside of Windows. Coda has made it possible for me to work with centralized files offline, and I have some ugly scripts involving perl, fetchmail, and procmail that handle email, but I wouldn't inflict them on others. An OS with automated "Network indifference" seems like it would be useful to both novice users and power users, and it's the sort of thing that could make these alternative operating systems more appealing to the masses. Are there any efforts in this direction that could use support or testers? Are people waiting until networking becomes so ubiquitous that the problem goes away?"