delphi 程序发布问题

http://topic.csdn.net/t/20030102/15/1320762.html

Delphi具有强大的数据库应用程序开发功能,其Client/Sever版本可以开发一般的单机数据库应用系统、普通Client/Sever应用系 统直至基于Web的多层应用,其中自然离不开Borland数据库引擎(BDE)的功劳。不过在没有安装过Delphi程序的计算机上运行数据库程序时, 必须同时分发庞大的BDE文件,Borland建议用户用Delphi附带的InstallShield制作安装程序来解决这些问题。但怎样选择BDE文 件才能使自己的安装程序更加精炼呢?我首先介绍一下其中几个必须的文件:  
    Idapi32.dll:BDE基本函数库  
    Blw32.dll:语言驱动函数库  
    Idr20009.dll:错误信息库  
    Fareast.bll:远东语言驱动程序  
    Usa.bll:美国语言驱动程序  
    以下文件为根据需要可选:  
    如用Paradox,则应选择:Idpdx32.dll  
    如用Dbase,则应选择:Iddbas32.dll  
    如用Access,则应选择:Iddao32.dll  
    如用Ascii,则应选择:Idasci32.dll  
    如用TBatchMove,则应选择:Idbat32.dll  
    如用Data   Repostitory,则应选择:Iddr32.dll  
    如用ODBC,则应选择:Idodbc32.dll  
    如用BDE   DataSet   Provider   DLL,则应选择:Idprov32.dll  
    如用SQL查询,则应选择:Idsql32.dll  
    下面我们就以用InstallShield来制作一个Paradox数据库应用系统的安装程序为例:  
    1.启动程序设置有关文件目录路径,进入Setup   Checklist;  
    2.在Set   the   Visual   Design中设置程序名、程序目录、安装程序主窗口等;  
    3.在Specify   Components   and   Files中设置Groups   and   Files项,在Program   Files中加入用户的所有程序文件和数据库表文件,以及下列文件:Idbat32.dll、Usa.btl、Idapi.cfg、 Charset.cvb、Bantam.dll、BLW32.dll、Idapi32.dll、Fareast.btl、Idpdx32.dll、 Idr20009.dll、Idsql32.dll(以上文件必须含目录路径);  
    4.在Dialog   Boxes中设置所需安装对话框;  
    5.在Make   Registry   Changes中设置Keys项,在HKEY_LOCAL_MACHINE中加入software/borland/blw32和software/ borland/database   engine两项,并且在blw32值中加入  
    “Blapipath   ‘以上文件目录’”、“LOCALE_LIB0   ‘以上文件目录’/Fareast.bll”和“LOCALE_LIB1   ‘以上文件目录’/Usa.bll”,在database   engine值中加入“Dllpath   ‘以上文件目录’”、“Configfile01   ‘以上文件目录’/Idapi.cfg”;  
    6.在Specify   Folder   and   Icons中根据实际要求设置有关项目;  
    7.在Run   Disk   Builder中设置安装盘的有关信息;  
    8.最后进行Test   the   Installation和Create   Distribution   Media即可完成安装程序的制作。  
  (新疆 宗宏斌)

http://community.csdn.net/Expert/TopicView3.asp?id=5290629

Delphi程序员都知道,在数据库应用程序开发完成后,要发布程序需要同时发布BDE(Borland Database Engine),否则会引起错误“A Error occurred while at temping to initilize Borland Database Engine(Error $2109)”。当觉得程序太大而辛辛苦苦精简自己的程序到满意时,却发现BDE管理程序器需要9M之巨,不由感到沮丧,真有点自己的努力被糟蹋的感觉。 不过也不必太沮丧,只要肯尝试,还是有办法来精简BDE的。

  首先来看看BDE目录中的文件,所有文件确实有近9M大吧。不过有些可能是用不到的, 关键文件的作用可参见Bde32.HLP中“Introduction to Borland Data base Engine”下的“Core BDE Files”,其中列出了BDE的关键文件及其作用,可以以此作为依据来尝试精简BDE驱动程序。下面是各个文件的作用:

 一、不可缺少的文件
  Blw32.dll:语言驱动函数库。
  Idapi32.dll:BDE基本函数库。
  Fareast.bll、Usa.bll:远东语言及美国语言驱动程序,对中文软件不可缺少。
  Idr20009.dll:错误信息库。

 二、数据库驱动程序(根据需要选择一个或多个)
  Idasci32.dll:Ascii文本数据库驱动程序函数库,如果不用Ascii文本数据库,可以不要。
  Iddao32.dll:Access数据库驱动程序函数库,如果不用Access数据库,可以不要。
  Iddbas32.dll:dBase数据库驱动程序函数库,如果不用dBase数据库,可以不要。
  Idodbc32.dll:ODBC数据库驱动程序函数库,如果不用ODBC数据库,可以不要。
  Idpdx32.dll:Paradox数据库驱动程序函数库,如果不用Paradox数据库,可以不要。

 三、其它驱动程序和配置文件(根据需要选择一个或多个)
  Idbat32.dll:批操作驱动程序函数库,如果不用TBatchMove控件或DbiBatchMove类函数,可以不要。
  Iddr32.dll:Data Repository驱动程序函数库,如果不用Data Repository功能,可以不要。
  Idprov32.dll:BDE DataSet provide驱动程序函数库,如果不用TProvider控件,可以不要。
  Idqbe32.dll:QBE驱动程序函数库,如果不用Query By Example,可以不要。
  Idsql32.dll:SQL查询驱动程序函数库,如果不用TQuery进行查询,可以不要。
  Idapi32.cfg:BDE配置文件,如程序中没特殊要求,可不要。也可在BDE管理器中设置正确后再分发。

 四、其它文件(一般不用)
  BDE32.HLP、BDE32.CNT:BDE帮助文件,可以不要。
  BdeAdmin.exe、BdeAdmin.HLP、BdeAdmin.CNT:BDE管理器及帮助文件,如果不会发生要求软件用户自己配置BDE的情况时,可以不要。
  其它*.BLL:其它国家和地区的语言驱动程序,可以不要。
  DataBump.EXE、DataBump.HLP、DataBump.CNT:数据库数据转移工具及帮助文件,可以不要。
  Localsql.HLP、Localsql.CNT:SQL查询语句帮助文件,可以不要。
  Sqllnk32.HLP、Sqllnk32.CNT:SQL连接帮助文件,可以不要。

  在根据需要选择文件后,还要写注册表文件。这个应该不成问题,可以手工设置,但最好在程序中设置,在发现注册表中没有相应键值时写入,用TRegFile对象用不了几行代码的。需要设置的注册表键值有(在调用数据库操作前需要有正确的键值存在):
  数据驱动程序所在目录的设置:
    HKEY_LOCAL_MACHINE/Software/Borland/Database Engine/DLLPATH(字符串值)
  语言驱动程序所在目录的设置:
    HKEY_LOCAL_MACHINE/Software/Borland/BLW32/BLAPIPATH(字符串值)
 语言驱动程序文件名:HKEY_LOCAL_MACHINE/Software/Borland/BLW32/LOCALE_LIB#(字符串值)
      其中#为编号,按顺序为0、1、2、3......如:
      HKEY_LOCAL_MACHINE/Software/Borland/BLW32/LOCALE_LIB0="fareasst.bll"
      HKEY_LOCAL_MACHINE/Software/Borland/BLW32/LOCALE_LIB1="usa.bll"

  就这些了,按此办法即可有效减少BDE驱动程序的大小,例如只用TTable控件操作Paradox数据库,则只要Idapi32.dll、 Blw32.dll、Idr20009.dll、Fareast.bll、Usa.bll、Idpdx32.dll六个文件即可。
这些文件可放在任何一个目录,只要在注册表指明即可。OK,BDE由9M多减到不到2M,ZIP一下就700多K了,比原来的应用系统减少了不少吧。

http://delphi.about.com/od/database/l/aa021502a.htm
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.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值