Every Delphi database connection is encapsulated by a Database corn-ponent, whether or not you actually place one in your project. The Database component is responsible for providing all of the connection information from the database to your application. An automatically generated database component is instantiated for each BDE application-; to encapsulate the connection.
The most important task of the Database component is to provide your : application with information about the type and location of the data files of your database. Recall that in setting up the alias in the BDE, you were required to specify the data location, the driver type, and some basic connection parameters. When a temporary database component is instantiated, these values are read from the BDE and passed to your application. This method of obtaining information about the database connection detracts from the scalability and installation flexibility of the application. For example, to simply specify a new location for the storage of data files, your users would be required to edit the BDE configuration files and modify the parameters of the alias used at the time of installation. This is certainly not the type of task that many users or
I 38 ■ Part II-The Delphi Database Tools administrators would be comfortable performing, especially in a complex client/server environment.
A persistent Database component, instantiated when a Database component is explicitly present in an application, brings the task of specifying the connection information into your application. Database connection parameters can then be stored with your application or in your application's keys in the Registry, allowing the user enormous flexibility in scaling or simply moving an application's data stores. In addition, much finer control over transactions and logins is possible when an explicit Database component is added to the application.
Was this article helpful?