Among the advantages of the separation of the BDE from the internals of Borland's development products is the freedom of choice. The open architecture of the Delphi development environment allows you to replace the database engine with other, sometimes better, products, Why would you want to consider this avenue? The reason that is most often listed supporting the replacement of the BDE is size and overhead. When you create a Delphi application and prepare it for distribution, you must also include the redistributable portions of the BDE. This can add enormously to the size of your distribution media and to the complexity of the installation.
Chapter 8-Tips and Techniques
Alternative database engines are available that bind directly to your application. This means that the engine becomes a part of the executable file, releasing you from the overhead of the external engine. When you distribute your application, only a single executable is required, which simplifies installation. In addition, there are no configuration issues involved as there can be with the BDE, setting up aliases and such. This type of replacement is generally referred to as a "thin" BDE replacement.
An alternate strategy to this approach, and one that is required for multi-user access, is to scale your application up to a client/server format. Using this strategy, all database transaction work occurs at the database server. The client code that is compiled into your executable only makes requests for data from the server. This approach is less about compressing the installation and more about performance and security Let's contrast the approach of the BDE and a typical client/server system.
When a database transaction occurs within the scope of an application using the BDE, the database file is opened and closed in response to the data request. This is because the BDE is a file manager system. All of the users of your application are opening and closing the same files through the auspices of the BDE. As you will discover when you build networked applications, there are high management requirements for locking and unlocking the rows and tables to maintain the integrity of the data.
A client server system takes a much different approach to handling the database transactions. The data tables are secured behind the server portion of the application. The client applications that sit on your user's desktops merely request that the server perform some transaction, whether it is a read or a write to or from the database. When the server receives the request, the concurrency controls of the server manage the integrity constraints, returning or accepting the transaction from the client without exposing the data tables to them. This approach offers a superior level of data integrity.
The following information gives you a brief idea of what is available to the Delphi programmer. It is not to be considered exhaustive, and complete coverage of each of the listed tools is beyond the scope of this book. Contact information is provided for each of the products so that you can explore them more fully.
Local InterBase Server (UBS)
The Local InterBase Server was seen earlier in the book when we discussed stored procedures. Though we used the BDE for access, this is not necessarily the required method. The LIBS can be accessed directly in a client/server mode, bypassing the BDE. Delphi provides a component, TClientDataSet, that can address the LIBS directly, giving you the advantages outline above.
connectivity is included with Delphi, making it an excellent choice for exploring the non-BDE options. Being a component-based solution and being able to initially address the local server make this an excellent tool for learning to build client/server applications. Another advantage of this approach is that scalability is excellent; the move from local to remote database access is simplified because the change from the local server to a remote server is nearly transparent.
Software Corporation 1800 Green Hills Road, Suite 150 Scotts Valley, CA 95066 (408) 430-1500 www.interbase.com
Was this article helpful?