1. Technology

Your suggestion is on its way!

An email with a link to:

http://delphi.about.com/od/database/l/aa021502a.htm

was emailed to:

Thanks for sharing About.com with others!

Deploying Delphi ADO database applications
It is time to make your Delphi ADO database application available for others to run. Once you have created a Delphi ADO based solution, the final step is to successfully deploy it to the user's computer.
 More of this Feature
Printer friendly versionPrinter friendly version
 Join the Discussion
"Post your views and comments to this chapter of the free Delphi database Programming Course"
Discuss!
 Related Resources
• free DB Course.TOC
• more Database articles
• Top installation tools
 Elsewhere on the Web
• MDAC download
• DCOM download

Once you have created a Delphi ADO based solution, the final step is to successfully deploy it to the user's computer. This is the topic will cover in this chapter of the free Delphi ADO database course.

What is required by a given application varies, depending on the type of application. Each project may contain several executable files, and a number of supporting files, such as DLLs, and package files. In most cases you'll only have one executable to install on a target computer - your application's executable file - Delphi produces applications wrapped in compact exe files, so called standalone Windows application.

Applications that access databases involve special installation considerations beyond copying the application’s executable file onto the target computer.

When deploying database applications that use ADO, you need to be sure that MDAC version 2.1 or later is installed on the system where you plan to run the application. MDAC is automatically installed with software such as Windows 98 / 2000 and Internet Explorer version 5 or later. No other deployment steps are required.

ADO on Windows 95
If your client's computer has Windows 95 you may get a warning indicating that you need DCOM95 to install MDAC, since there is no support for ADO in Windows 95. Once you install DCOM95, you'll can proceed and install MDAC. Here's a tip how to find the OS version.

MS Data Version Checker
One of the tools that might be handy is the Microsoft's Component Checker. The Component Checker tool is designed to help you determine installed version information and diagnose installation issues with the Microsoft Data Access Components (MDAC).

The database file
The data files (in our case an MS Access database), must be made available to the application. You make it available by simply copying (an "empty") the MDB file to the client computer. The process must be done before the user first start the application. Each time you send an updated exe file, if the structure of the database has not changed, you do not need to redeploy the MDB file.

The connection string
Obviously, when creating database applications that are to be run on various machines, the connection to the data source should not be hard-coded in the executable. In other words, the database file may be located anywhere on the user's computer - the connection string used in the TADOConnection object must be created at run time. One of the suggested places to store the path to the database is the Windows Registry. In general to create a connection string at run time you have to a) place the Full Path to the database in Registry; and b) each time you start your application, read the Registry, "create" the ConnectionString and Open the ADOConnection. Here's a sample code.

Is that all? This seams to easy
Yes, when described by words it seems very easy, just copy the exe file, the mdb file and be sure the client computer has MDAC. Of course, the first time you try to deploy your state-of-the-art database solution you'll bump into a wall. How to copy a file on another computer to a folder like '\Program Files\YOUR COMPANY\PROJECT NAME\ApplicationName.exe'? There is an answer that might solve most of the problems, the installation tools. The Install Sheild Express that comes with some Delphi versions can be used to create an installation application. This tool gives your users the ability to select where to install your application, let's the user decide what parts of the application would be installed (exe, help, mdb, ...) and makes the process of creating a Project group in the Start menu easy. Creating insulation applications with IE Express is not hard nor is it trivial. I'll leave this for some future article.

   To the next chapter
If you need any kind of help at this point, please post to the Delphi Programming Forum where all the questions are answered and beginners are treated as experts.

DB Course Next Chapter >>
>> Delphi ADO/DB programming: Real Problems - Real Solutions

©2014 About.com. All rights reserved.