Accessing a Relational Database Through an Object-Oriented Database Interface (Extended Abstract)

Accessing a Relational Database Through an Object-Oriented Database Interface (Extended Abstract)

Accessing a Relational Database through an Object-Oriented Database Interface (extended abstract) J. A. Orenstein D. N. Kamber Object Design, Inc. Credit Suisse [email protected] [email protected] Object-oriented database systems (ODBs) are Typically, their goal is not to migrate data from designedfor use in applicationscharacterized by complex relational databases into object-oriented databases. data models, clean integration with the host ODBs and RDBs are likely to have different programming language, and a need for extremely fast performance characteristics for some time, and it is creation, traversal, and update of networks of objects. therefore unlikely that one kind of systemcan displace Theseapplications are typically written in C or C++, and the other. Instead,the goal is to provide accessto legacy the problem of how to store the networks of objects, and databasesthrough object-orientedinterfaces. update them atomically has been difficult in practice. For this reason, we designed and developed, in Relational databasesystems (RDBs) tend to be a poor fit conjunction,with the Santa Teresa Labs of IBM, the for these applications because they are designed for ObjectStoreGateway, a systemwhich providesaccess to applications with different performance requirements. relationaldatabasesthrough the ObjectStoreapplication ODBs are designedto meet theserequirements and have programming interface (API). ObjectStore queries, proven more successful in pioviding”persistence for collectionand cursor operationsare translatedinto SQL. applicationssuch as ECAD and MCAD.’ The tuple streamsresulting from execution of the SQL Interest in ODBs has-spread be$ond the CAD query are turned into objects;these objects may be either communities, to areas such as finance and transient, or persistent, stored in an ObjectStore telecommunications. These applications have many database.The main design goal of the Gateway was to similarities to CAD applications. For example, in insulate application developers from SQL and the financial applications, the data structuresdescribing a relational schema,and to permit them to work entirely mutual fund’s portfolio can be quite complex, in an object-orientedparadigm. applications are written in C or C++, and fast traversal In this abstract we describe how we adapted the of the data structuresis important. ObjectStore API to the purposes of the Gateway, and These application areas often have an additional how we extended the API when there were no requirement- the need to make use of “legacy” data equivalentconcepts with no equivalentin ObjectStore. storedin relational databasesystems (RDBs). For years, We assume the reader is familiar with ObjectStore the developers of these applications have worked in LAMB9 1; OREN92].,The accompanyingpresentation non-object-oriented languages; and have had to deal will discuss the use of the Gateway in an application with the problem of turning tuple streams into the developed by Credit Suisse to. yield enhanced complex data structures manipulated by their concurrency in both worlds and requiring only a applications. Now, the developers who have started minimal coupling between the object-oriented model using object-oriented languagesand databasesystems and the ER model. would like to continue the transition by insulating themselves from the relational model and SQL. Overview of the &tqway’s L&sigh The main design goal of the Gateway was to support the developersof ObjectStoreapplications that need access to legacy data, whiIe insulating these developersfrom all aspectsof the RDB: the schemaof Permission to copy without fee all or part of thiu material is granted the RDB being accessed;the programming interface to provided that the copies are not made or distributed for direct com- mercial advantage, the VLDB copyright notice and the title of the the RDB; and SQL. Because of the need to provide publication and its date appear, and notice is given that ‘copying is by permission of the Very Large Data Bsse Endowment. To copy access to existing databases, we cannot control the otherwise, or to republish, requires a fee and/or special permission relational schema.For example,it would be convenient from the Endowment. Proceedinga of the Slat VLDB Conference to dictate the typesand values of primary and foreign Zurich, Switzerland, 1905 keys as this would simplify the export of object ids and 702 pointers. However, this approach cannot be used with be used for one-to-oneand one-to-manyrelationships). legacyRDBs. There are a few ways to represent relationships in There is little point in eliminating SQL and the ObjectStore’.SML supports all combinations of these relational schema from view if the alternative is a relational and ObjectStore representations. If a completely new and unfamiliar interface. For this relational schema uses modeling techniques not reason, another important design goal was to allow supportedby SML, then the user should createan SQL developersto use the existing ObjectStore data model view. Over time, SML will be enhancedto supportmore and API. For example,application developers should be modelingmethodologies. able to use pointers, embedded collections, and C++ functions can be associatedwith mappings relationships as they do normally. It should not be between tables and classes,and,between columns and necessaryto introduce similar but different constructs, datamembers. Examples: nor shouldit be necessaryto work with a relational style Run the function Employee:: of schema,(i.e. no pointers, no embeddedcollections), initialize whenever an Employee dressedup as C++. We found it necessaryto balance object is generatedfrom an EMPtuple. ’ this design goal againstperformance goals. In a number of situations it was necessary to compromise the Run the function Name : : import whenever Gateway’s API to avoid introducing serious three CHARcolumns are mapped to a data performanceproblems. member of type Name, (the, three CHAR These design goals motivate the central piece of columns represent first, middle and last the Gateway’s design, the schema mapping. A schema IUUWS). mapping captures the correspondences between a Run the function Name : : export, which relational schema and an ObjectStore schema. For turns a Name into three strings, whenever a example,a schemamapping would record the fact that a Name is written back to. the relational foreign key correspondsto the two data membersin an database. ObjectStore schema that represent a relationship. A schema mapping is created using a declarative language. Once this has heen’done; Gateway Connecting to a relational database applications can be built by identifying the schema In or&r to connect to an RDB, the user id and mapping and linking with Gateway libraries. The passwordmust be supplied. This is done via an object representingthe databasez Gateway uses the schema mapping to translate os-gw-database& empdb = ObjectStore operations into SQL, and to materialize os-w-gateway:: objects from the resulting tuple streams and status get-database("EMPDB"); indicators. (The schemamapping is also used as the empdb.set-userid("henry"1; foundation for ObjectStore SQL Client T a product empdb.setgassword("eraserhead"); which provides access to ObjectStore databasesvia EMPDBis the logical name of the RDB beii accessed; SQL.1 this name was given-in SML. empdb is an object representing this database.In addition to setting the Schema mapping ’ user id and password,various RDB-specific properties There are three inputs to a schemamapping, 1) a can be controlled using a function of relational schema,2) an ObjectStore schema,and 3) a os-gw-databasethattakes keywordsandvalues. declarative~specification of the connectionsbetween the Once the user id and passwordhave beensupplied, two schemas. All three parts are specified in SML the relational database is accessible from the (Schema Mapping .Language). The schemas are application. imported from relational and ObjectStore databases namedin the SML specification. ObjectStore functions that are The bulk, of an SML specification is in the t&slated to SQL descriptionof the connections.This part of the language -The Gateway translates ObjectStore collection is basedon the premisethat variousmodeling constructs methods (including queries) and cursor methods into are.expressed by common “idioms” in each datamodel. SQL. When one of these methods is applied to a For example,a join betweena foreign key and a primary key is often used to represent one-to-one and one-to- many relationships; two suchjoins through a “junction ’ Either with or without the relationship wrappers: the “many” table” representa many-manyrelationship (but can also side of a relationship can be.a type-safe collection, e.g. os~Set&nploy&>, or type-unsafe, e.g. 08-s& 703 collection representing a table, a semantically of a databaseinorder to support any navigation that the equivalent set of SQL commands is generated and application might perform following the query. This is submitted to the RDB. In addition to query translation, clearly impractical. ObjectStorecursors operationsare translatedinto SQL Another possibility is to retrieve just the primary cursor operations,and insertions to and removalsfrom key columns and turn these into object identities or ObjectStorecollections are translatedinto SQL INSJZRT pointers. When the application tries to dereferenceone and DELETE statements. of thesepointers, anotherquery is generatedto retrieve There is no function call required by ObjectStore the pointed-to object. As with updates,not

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us