Understanding JBuilder's DataExpress architecture

Database application development is a feature of JBuilder Professional and Enterprise. Distributed application development is a feature of JBuilder Enterprise.

DataExpress components were designed to be modular to allow the separation of key functionality. This design allows the DataExpress components to handle a broad variety of applications. Modular aspects of the DataExpress architecture include:

The benefits of using the modular DataExpress Architecture include:

For more information on the DataExpress architecture, visit the Borland web site at http://www.borland.com/jbuilder/ for a white paper on this topic.


The Borland database-related packages

The core functionality required for data connectivity is contained in the com.borland.dx.dataset, com.borland.dx.sql.dataset, and com.borland.datastore packages. The components in these packages encapsulate both the connection between the application and its source of the data, as well as the behavior needed to manipulate the data. The features provided by these packages include that of database connectivity as well as data set functionality.

The main classes and components in the Borland database-related packages are listed in the table below, along with a brief description of the component or class. The right-most column of this table lists frequently used properties of the class or component. Some properties are themselves objects that group multiple properties. These complex property objects end with the word Descriptor and contain key properties that (typically) must be set for the component to be usable.

Component/Class Description Frequently used properties
Database A required component when accessing data stored on a remote server, the Database component manages the JDBC connection to the SQL server database.

See "Connecting to a database" for more description and a tutorial using this component.

The ConnectionDescriptor object stores connection properties of driver, URL, user name, and password. Accessed using the connection property.
DataSet An abstract class that provides basic data set behavior, DataSet also provides the infrastructure for data storage by maintaining a two-dimensional array that is organized by rows and columns. It has the concept of a current row position, which allows you to navigate through the rows of data and manages a "pseudo record" that holds the current new or edited record until it is posted into the DataSet. Because it extends ReadWriteRow, DataSet has methods to get and put field values.

The SortDescriptor object contains properties that affect the order in which data is accessed and displayed in a UI component. Set using the sort property. See "Sorting data" for a tutorial.

The MasterLinkDescriptor object contains properties for managing master-detail relationships between two DataSet components. Accessed using the masterLink property on the detail DataSet. See "Establishing a master-detail relationship" for a tutorial.

StorageDataSet A class that extends DataSet by providing implementation for storage of the data and manipulation of the structure of the DataSet.

You fill a StorageDataSet component with data by extracting information from a remote database (such as InterBase or Oracle), or by importing data stored in a text file. This is done by instantiating one of its subclasses: QueryDataSet, ProcedureDataSet, or TableDataSet.

The tableName property specifies the data source of the StorageDataSet component.

The maxRows property defines the maximum number of rows that the DataSet can initially contain.

The readOnly property controls write-access to the data.

DataStore The DataStore component provides a replacement for MemoryStore that gives a permanent storage of data. A JDataStore provides high performance data caching and compact persistence for DataExpress DataSets, arbitrary files, and Java Objects. The DataStore component uses a single file to store one or more data streams. A JDataStore file has a hierarchical directory structure that associates a name and directory status with a particular data stream. JDataStore can be treated like any SQL database - you can connect to it as you would to any server, run SQL queries against it, etc.

See "Persisting and storing data in a JDataStore" in Database Application Developer's Guide, and the JDataStore User's Guide, for more description of the DataStore component.

Caching and persisting StorageDataSets in a DataStore is accomplished through two required property settings on a StorageDataSet called store and storeName. By default, all StorageDataSets use a MemoryStore if the store property is not set. Currently MemoryStore and DataStore are the only implementations for the store property. The storeName property is the unique name associated with this StorageDataSet in the DataStore.
DataStoreDriver DataStoreDriver is the JDBC driver for the JDataStore. The driver supports both local and remote access. Both types of access require a user name (any string, with no setup required) and an empty password.  
QueryDataSet The QueryDataSet component stores the results of a query string executed against a server database. This component works with the Database component to connect to SQL server databases, and runs the specified query with parameters (if any). Once the resulting data is stored in the QueryDataSet component, you can manipulate the data using the DataSet API.

See "Querying a database" for more description and a tutorial using this component.

The QueryDescriptor object contains the SQL query statement, query parameters, and database connection information. Accessed using the query property.
ProcedureDataSet The ProcedureDataSet component holds the results of a stored procedure executed against a server database. This component works with the Database component in a manner similar to the QueryDataSet component.

See "Obtaining data through a stored procedure" for more description and a tutorial using this component.

The ProcedureDescriptor object contains the SQL statement, parameters, database component, and other properties. Accessed using the procedure property of the ProcedureDataSet component.
TableDataSet Use this component when importing data from a text file. This component extends the DataSet class. It mimics SQL server functionality, without requiring a SQL server connection.

See "Importing data from a text file" for more description and a tutorial using this component.

The (inherited) dataFile property specifies the file name from which to load data into the DataSet and to save the data to.
DataSetView This component presents an alternate "view" of the data in an existing StorageDataSet. It has its own (inherited) sort property, which, if given a new value, allows a different ordered presentation of the data. It also has filtering and navigation capabilities that are independent of its associated StorageDataSet.

See "Presenting an alternate view of data" for more description and a tutorial using this component.

The storageDataSet property indicates the component which contains the data of which the DataSetView presents a view.
Column A Column represents the collection from all rows of a particular item of data, for example, all the Name values in a table. A Column gets its value when a DataSet is instantiated or as the result of a calculation.

The Column is managed by its StorageDataSet component.

See "Working with columns" for more description and a tutorial using this component.

You can conveniently set properties at the Column level so that settings which affect the entire column of data can be set at one place, for example, font. JBuilder design tools include access to column-level properties by double-clicking any StorageDataSet in the content pane, then selecting the Column that you want to work with. The selected Column component's properties and events display in either the Column designer (properties only) or in the Inspector and can be edited in either place.
DataRow The DataRow component is a collection of all Column data for a single row where each row is a complete record of information. The DataRow component uses the same columns of the DataSet it was constructed with. The names of the columns in a DataRow are field names.

A DataRow is convenient to work with when comparing the data in two rows or when locating data in a DataSet. It can be used in all DataSet methods that require a ReadRow or ReadWriteRow.

 
ParameterRow The ParameterRow component has a Column for each column of the associated data set that you may want to query. Place values you want the query to use in the ParameterRow and associate them with the query by their parameter names (which are the ParameterRow column names).

See "Using parameterized queries to obtain data from your database" for more description and a tutorial using this component.

 
DataModule The DataModule is an interface in the com.borland.dx.dataset package. A class that implements DataModule will be recognized by the JBuilder designer as a class that contains various dataset components grouped into a data model. You create a new, empty data module by selecting the Data Module icon from the File|New dialog. Then using the component palette and content pane, you place into it various DataSet objects, and provide connections, queries, sorts, and custom business rules logic. Data modules simplify reuse and multiple use of collections of DataSet components. For example, one or more UI classes in your application can use a shared instance of your custom DataModule.

See "Using data modules to simplify data access" for more description and a tutorial using this component.

 

There are many other classes and components in the com.borland.dx.dataset, com.borland.dx.sql.dataset, and com.borland.datastore packages as well as several support classes in other packages such as the util and view packages. Detailed information on the packages and classes of DataExpress Library can be found in the DataExpress Library Reference documentation.