RAD Studio
ContentsIndex
PreviousUpNext
Database architecture
Name 
Description 
By using a provider component, you can connect TClientDataSet to another (source) dataset. The provider packages database information into transportable data packets (which can be used by client datasets) and applies updates received in delta packets (which client datasets create) back to a database server. The architecture for this is illustrated in the following figure.

This architecture represents either a single-tiered or two-tiered application, depending on whether the database server is a local database or a remote database server. The logic that manipulates database information is in the same application that implements the user interface, although isolated into... more 
The most common database architecture is the one where the dataset uses a connection component to establish a connection to a database server. The dataset then fetches data directly from the server and posts edits directly to the server. This is illustrated in the following figure.
Connecting directly to the database server

Each type of dataset uses its own type of connection component, which represents a single data access mechanism:
  • If the dataset is a BDE dataset such as TTable, TQuery, or TStoredProc, the connection component is a TDataBaseobject. You connect the dataset to the database... more 
There are specialized client datasets that use the BDE or dbExpress to connect to a database server. These specialized client datasets are, in fact, composite components that include another dataset internally to access the data and an internal provider component to package the data from the source dataset and to apply updates back to the database server. These composite components require some additional overhead, but provide certain benefits:
  • Client datasets provide the most robust way to work with cached updates. By default, other types of datasets post edits directly to the database server. You can reduce network traffic by using... more 
Database applications are built from user interface elements, components that represent database information (datasets), and components that connect these to each other and to the source of the database information. How you organize these pieces is the architecture of your database application.
While there are many distinct ways to organize the components in a database application, most follow the general scheme illustrated in the following figure:
 
The simplest form of database application you can write does not use a database server at all. Instead, it uses MyBase, the ability of client datasets to save themselves to a file and to load the data from a file. This architecture is illustrated in the following figure:

When using this file-based approach, your application writes changes to disk using the client dataset's SaveToFile method. SaveToFile takes one parameter, the name of the file which is created (or overwritten) containing the table. When you want to read a table previously written using the SaveToFile method, use the LoadFromFile method. LoadFromFile... more 
When the database information includes complicated relationships between several tables, or when the number of clients grows, you may want to use a multi-tiered application. Multi-tiered applications have middle tiers between the client application and database server. The architecture for this is illustrated in the following figure.

The preceding figure represents three-tiered application. The logic that manipulates database information is on a separate system, or tier. This middle tier centralizes the logic that governs your database interactions so there is centralized control over data relationships. This allows different client applications to use the same data, while ensuring consistent data logic.... more 
There is no reason why you can't combine two or more of the available architectures in a single application. In fact, some combinations can be extremely powerful.
For example, you can combine the disk-based architecture described in Using a dedicated file on disk with another approach such as those described in Connecting to another dataset or Using a multi-tiered architecture. These combinations are easy because all models use a client dataset to represent the data that appears in the user interface. The result is called the briefcase model (or sometimes the disconnected model, or mobile computing).
The briefcase model... more 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!