Installing the Borland Database Engine with DeployMaster

Installing the BDE and Creating Aliases

Follow these steps to include the BDE with your deployment package:

1. Find the file BDEInst.cab in the BDE folder on your hard disk or on your Borland development tool (Delphi) CD. Use a program like WinZIP to extract the file BDEInst.dll from the CAB file. This DLL contains the Borland Database Engine along with a self-extracting installation program created by Borland. By letting this DLL do the dirty work, we make sure that the BDE is properly installed.

2. Add the file BDEInst.dll to the %APPFOLDER% folder in your DeployMaster setup package. Important: If you are using the sample DeployBDE support DLL, you must turn off the option to call DllRegisterServer! The DeployBDE sample support DLL will call it, and if you let DeployMaster call it also, the BDE will be installed twice.

3. Download the source code for DeployBDE.dll and open it in Delphi. You will need to edit the “alias creation” section in the FinishDeployment procedure so it creates the aliases you want instead of the sample. The comments in the source code explain how to do this. Then compile the project with Delphi into DeployBDE.dll

4. Specify the DeployBDE.dll as the Support DLL on the Project page in the DeployMaster Builder.

5. Build the deployment package, test it and distribute it to your customers.

How this works

When DeployMaster is finished installing your application, it will have created the file BDEInst.dll in your application’s program folder on the user’s computer. Then, DeployMaster will call the FinishDeployment procedure in the support DLL you included with your package. The FinishDeployment procedure from DeployBDE.dll will load BDEInst.dll and call its DllRegisterServer routine. This routine will take care of the entire BDE installation. When the routine returns, BDEInst.dll is unloaded and deleted since it no longer serves any purpose.

After installing the BDE, you can create BDE aliases in the FinishDeployment routine. This is done by calling a few low-level routines from the BDE unit that ships with Delphi. You can request help on these routines by putting the text cursor on them in the Delphi IDE and pressing F1.

First, DbiInit is called to load the BDE. Then call DbiAddAlias to create the aliases, DbiCfgSave to save the modified BDE configuration file and finally call DbiExit to unload the BDE.

SQL Links

The method for installing the BDE described above does not install SQL Links. SQL Links is required if you use the BDE to communicate with a SQL database such as InterBase or MS SQL Server.

You could try to do the following, but I have not tested this myself:

1. Read the file bdedeploy.txt in the BDE folder on your computer. It contains information on what files you need to redistribute to support SQL Databases. Example: SQL-Links drivers for Interbase: SQLINT32.DLL (Interbase driver) and SQL_INT.CNF (BDE-config file for Interbase driver)

2. Look into the HKEY_LOCAL_MACHINE\Software\Borland\Database Engine\Setting\Drivers registry key on your computer. Select the subkey matching your Database driver (e.g. Interbase: subkey “INTRBASE”). Add all these keys to the Registry tab in DeployMaster or modify the BDEInst.dll to create them.

3. Add the files from step 1 to your DeployMaster package. These should be installed into the folder listed in HKEY_LOCAL_MACHINE\Software\Borland\Database Engine\DLLPATH after the BDE has been installed. Since this installation is only done in FinishDeployment(), you should let DeployMaster install those files in %APPFOLDER% (where it is also installing BDEInst.dll) and then move the files into the correct position in the FinishDeployment() DLL routine, after the BDE has been installed.

Uninstall

Uninstalling the BDE through the DeployMaster uninstaller is not possible.

Since there is no way to figure out how many applications on the user’s system depend on the BDE, uninstalling it is probably not desirable anyway.

If you want to uninstall your BDE aliases, you can let your own application do so. In DeployMaster, specify your application’s executable on the uninstall path on the Finish tab with an uninstall parameter. Modify your application so that when the uninstall parameter is present, it will remove the alias and terminate with Halt(1). Terminating with an exit code of 1 is important, otherwise the uninstaller will think the uninstallation should be canceled.

To remove an alias, use DbiInit, DbiDeleteAlias, DbiCfgSave and DbiExit like in the DeployBDE.dll used for creating them.

Faulty Free Disk Space Check

The BDE was discontinued by Borland many years ago. One issue that has cropped up is that the BDE installer uses a signed 32-bit integer to check for free disk space. This causes the BDE installer to incorrectly report that there’s not enough free disk space if your hard disk has more than 2 GB of free space. If the user tells the installer to continue regardless, the BDE will be installed correctly.

To fix this, you can download an unofficial patch BdeInstDiskSpacePatch.zip. Extract BdeInstDiskSpacePatch.exe from the .zip archive, place it into the same directory as BdeInst.dll, and run. The patch will make a one-byte change to BdeInst.dll that disables the free disk space check. Since the BDE uses only a few megabytes of disk space, any modern PC should have enough free space.