An overview of dbKona architectureThis paper describes the features and architecture of the WebLogic dbKona database connectivity utility.
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.
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.
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 objects have methods for returning the contents of
each field as a Value object.
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".
|
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|