BEA Logo BEA WebLogic Server Release 5.0

  Corporate Info  |  News  |  Solutions  |  Products  |  Partners  |  Services  |  Events  |  Download  |  How To Buy

An overview of dbKona architecture

This paper describes the features and architecture of the WebLogic dbKona database connectivity utility.

Contents
Introduction to dbKona
dbKona classes
dbKona extensions

Introduction to dbKona

As the client-server paradigm evolves into a more heterogenous collection of clients accessing information from many sources distributed over the network, there is a need for new tools for connecting clients and data. And as database data becomes more and more necessary to every aspect of business applications, application developers without a lot of database programming experience need general-purpose methods to access to data.

In the Java, JDBC-standards-based world, dbKona satisfies those needs. dbKona is a set of high-level Java objects that simplify working with with DBMS data. It can be used with any JDBC driver to communicate with multiple, heterogeneous databases in a vendor-independent way, in both a two-tier client-server configuration or within the WebLogicTM multitier framework.

dbKona offers convenient ways to work with and manage DBMS data in a Java application. By separating the use of database data from vendor-specific functions required to access that data, dbKona offers both database and non-database programmers ways to carry out database operations on general, abstract data objects in the dbKona metaphor.

dbKona provides a higher level of abstraction than JDBC, which deals with low-level details of managing data. With the dbKona objects, a programmer can use database data without a lot of special knowledge about each vendor's particular methodology of storing, updating, and retrieving data, or of special, vendor-specific data types and table structures. dbKona has methods for the automatic generation of SQL; with a general understanding of SQL, but with no specific vendor-related SQL knowledge, a programmer can write queries to insert, update, and delete records in a DBMS.

dbKona's general data container object is the DataSet, which contains objects called Records, which contain objects called Values. A Value object encapsulates data and its structure and type; a Java application that uses data in a Value object does not need to know anything about its structure and type, but that information is inherent in each Value and can be accessed by the programmer as desired.

A dbKona DataSet allows a great deal of freedom in navigating through its constituent records, unlike JDBC's ResultSet, which is limited to iterating forward through records with the next() method.

dbKona also has methods and objects that provide automatic generation of SQL. For example, instead of supplying an SQL statement something like select * from emp where empsalary < 80000 and empdept = "Sales", the developer can construct a TableDataSet with just two arguments -- a connection object that represents the connection to a DBMS, and the name of a DBMS table -- and then can use the TableDataSet.where() method to set parameters on employee salary and department. The SQL for retrieving the records is generated automatically when the first record is requested.

dbKona can be used with any JDBC driver, including the WebLogic jDriver family--WebLogic jDriver JDBC drivers for Oracle, Informix, and Microsoft SQL Server. In fact, the same dbKona application may use an assortment of JDBC drivers to manipulate data that is then presented in a single interface to the user.

dbKona can also be used with WebLogic/JDBC, WebLogic's pure-Java JDBC implementation, within WebLogic's multitier framework. (For more on WebLogic's multitier solutions for database connectivity, see the companion whitepaper.) When used in a multitier environment with WebLogic/JDBC, dbKona allows for server-side caching of results to improve performance, and within WebLogic's framework, a WebLogic client using dbKona has access to features like persistent client workspaces and cached DBMS connections and query results. A dbKona DataSet (or any other arbitrary object) can be saved in its client workspace, and the client can go away and return later to work with the same data and connections.

Following is an overview of the dbKona classes, which are currently in the Java packages weblogic.db.jdbc. More precise API information is available in the developers guide and API reference manual. For examples, see the WebLogic dbKona examples and demos.

dbKona classes

DataSet
The DataSet object is the abstraction used by dbKona to cache records retrieved from a DBMS. A DataSet is used to fetch records from a DBMS, send records to a DBMS, and add and modify records those records. A DataSet is roughly equivalent to a table in SQL.

The DataSet class contains methods to add a record and clear all records, but deletes and updates are done through the Record object. Each DataSet has a Schema, which is a object describing the name, datatype, size, and order of each field in the DataSet.

DataSet is a virtual class, with subclasses QueryDataSet and TableDataSet.

QueryDataSet
A QueryDataSet, a subclass of DataSet, holds the results of a SQL query; a QueryDataSet's results may come from more than one DBMS table. The query is not run against the DBMS until the application asks for the first record in the DataSet. Changes made in a QueryDataSet cannot be saved to the DBMS.

TableDataSet
A TableDataSet holds the results of a query against a SQL table. Its data retrieval parameters can be refined with dbKona methods that set SQL clauses like WHERE and ORDER-BY.

A TableDataSet may be associated with a KeyDef, which sets the key for SQL updates or deletes. A TableDataSet is also associated with a SelectStmt, which allows the developer to use Query-by-example (QBE).

Record
Record objects are the dbKona equivalent of rows in SQL, with fields of different datatypes. Each record has an associated Schema, which is a desciption of the name, datatype, size, and order of each field in the record. A Record can be created either as part of a DataSet, using its Schema, or independently. A Record created independently must get its schema from an SQL table on an active Database session.

Record objects have methods for returning the contents of each field as a Value object.

Value
The Value object contains values for fields in individual records. A Value can contain any of the types described in java.sql.Types. There are methods to set, get, and return the type of a Value. Values can be Null.

Schema
A Schema object describes all the attributes (columns) of a Record, DataSet, or SQL table. The description of each attribute includes name, datatype, size, and order of each field.

Column
Column objects describe individual attributes (columns) in a Schema.

KeyDef
A KeyDef object is used to define the key fields on a table or TableDataSet, for use in updates and deletes by key.

For example, assume a TableDataSet bound to the employee table, with KeyDef firstName and lastName. The application requests an update on the column salary for a Record with firstName = Joan and lastName = Smith. In that case, dbKona would update the DBMS table for a TableDataSet by generating an update statement like: "UPDATE emp SET salary = 50000 WHERE firstName = Joan and lastName = Smith".

SelectStmt
SelectStmt is a class used to build Select statements out of field names, WHERE clauses, etc. SelectStmt objects have methods that allow the programmer to build SQL statements using Query-by-example (QBE).

dbKona extensions

WebLogic provides one vendor-specific extension for dbKona: a Sequences object, for use with Oracle sequences. Other extensions may be provided in the future.

 

Copyright © 2000 BEA Systems, Inc. All rights reserved.
Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.
Last updated 01/13/2000