Introduction to the Borland Database Engine (BDE)

   

The Borland Database Engine (BDE) is a language-independent layer directly beneath the VCL. Borland created it to allow various database formats to work seamlessly with their programming tools.

Supported formats include

  • Desktop databases: ASCII delimited (text), xBase, Paradox

  • Client/server databases: Oracle, Interbase, Sybase, and others.

  • Open Database Connectivity (ODBC): Note that ODBC leaves the door open for many other formats (Access, for instance) because, as a Microsoft standard, it has led to the creation of a wide variety of drivers.

As you can see, the BDE enables you to use very different database formats without having to purchase and learn new components . In fact, it is often effortless to use different database engines with the same application. And a special feature of the BDE, heterogeneous joins, enables you to join tables across different database management systems ”something still unavailable from any other commonly available technology.

Furthermore, the BDE hides the complexity of many powerful features such as transactions, cached updates, and XML. The bottom line is that it enables you to concentrate on what data to fetch instead of how to fetch it.

The BDE also abstracts the complexity of connecting to a database by allowing BDE components in the VCL to simply reference an alias . The alias is a name established by the developer or installer by using the BDE administration tool ( bdead min32.exe ) to associate the name with a database driver and its settings, including those that identify the location of the database itself.

As can be expected, there is a price to pay. The BDE can seem expensive in terms of memory and disk space. These issues might be less compelling, of course, as the power of typical computers increases .

There are many different ways to use the BDE, including desktop (single tier), client/server (two tier ).

Single-Tier

This is great for small programs where performance and price are more important than database-engine power or data security and integrity. Shared desktop databases are not robust for multiuser access, but a single- user desktop database can add great flexibility to a program at low cost.

Advantages
  • Using any of these formats will yield the best performance while using the VCL.

  • Many of these formats are royalty free.

  • xBase is a very popular format on PCs and is recognized by most applications that allow importing.

  • It is relatively easy to switch formats.

  • There is no need to purchase and learn new components/libraries.

Disadvantages
  • None of these formats provide good security or internal integrity. Use on a network or in multiuser settings requires great care and is sometimes dangerous because each application updates tables directly, and those updates are, therefore, capable of overwriting each other.

BDE/SQL Links (Client/Server)

This provides the most power, flexibility, and integration for the price without adding the extra complexities of a multitier architecture.

Advantages
  • All database engines (DBMS) supported by SQL Links use client/server technology.

  • All database engines supported by SQL Links are true relational databases.

  • It is relatively easy to switch database engines.

  • It performs better than ODBC.

Disadvantages
  • Most of these database formats require royalties.

  • SQL Links drivers are DBMS-specific and support only Oracle, Sybase, MS SQL Server, Informix, DB2, Access, and InterBase.

  • The BDE plus SQL Links puts two layers between the program and the database engine, which can affect performance.

ODBC Using the BDE

Open Database Connectivity (ODBC) is a Microsoft initiative that has become an industry-wide standard. Like SQL Links, you can think of it as a translator for DBMS APIs. The difference is that any vendor can provide a driver for its database format to become an ODBC data source. Thus, virtually all database engines have an ODBC driver today.

ODBC achieves DBMS independence by inserting two layers before the database engine. The first provides a standard API that applications can count on being consistent. It is the ODBC client. The second is the driver that does the translation.

Advantages
  • ODBC is an industry-wide standard.

  • It can work with the BDE and no program changes are required when switching between native BDE, SQL Links, or ODBC drivers, which offers great flexibility.

  • It allows the same application to work with virtually any database, regardless of its format (provided there is an ODBC driver for it).

  • It can turn an otherwise single-tier application into a client/server application.

  • There will be no need to purchase and learn new components/libraries.

Disadvantages
  • The BDE and ODBC combined have large disk and memory requirements, which can reduce performance. Furthermore, there are now three layers between the program and the database engine.

  • Some ODBC drivers are not robust. It is important to check the one you intend to use before committing to this architecture.

  • Upgrading is an issue. The application, the VCL, the BDE, the ODBC manager/client, the ODBC driver, and the database engine must all be updated independently.

Hedging Your Bets

It is a good idea to immediately create a thin layer between your system and the data components you choose to use. You can do this by creating a descendant or facade for each component you intend to use, and never using the raw components themselves in your system. You can then change the ancestor of the component, or the type of its contained component, either directly or by conditional compilation, and all the uses of the component will, hopefully without change, use the new component set. If you must use specialized methods or properties of the underlying components, try first to hide them in methods or properties of a more general nature in the thin layer. If that cannot be done for some reason, bracket them with #ifdef , #else , #endif commands keyed on a #define that identifies the underlying components in use.


   
Top


C++ Builder Developers Guide
C++Builder 5 Developers Guide
ISBN: 0672319721
EAN: 2147483647
Year: 2002
Pages: 253

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net