This
banner was supplied by SAFE Audit
This banner was supplied by SAFE Audit
Using Delphi with databases
This page was created for programmers, which use Delphi and SQL.
You may find more informations and useful components on this page oriented on using Delphi with databases.
All components was tested with our projects (we used Delphi 4.0). All rights reserved on components and products. You may use informations for programming on any version Delphi and C++ Builder.
Your developments will be include this steps:
0. Development structure of database.
Structure of your database must ensure:
- independence given (from physical organizations of memory and hardware system desksides, from a reconstructing given in DB, from the logical structure, i.e. possibility of painless moving a ready database in other program);
- nonredundancy given for the reason shortenning a volume of memory, time of renovations, threats of uncoordinated change;
- interaction with different types of users (manager, toolsmith, applied programmer and etc);
- wholeness of data, i.e. data are to be noninconsistent;
- insufficiency of access and confidentiality information (for given elements, operations and etc);
- compatibility and displacement data.
Much much useful information you are to find in literature on server ...
1. Choice of architecture.
- one-user DB;
- system with collective using the files;
- architecture of type a client-server.
Your choice will depend from your problems, as well as requirements to system perfomance. If work with your databases will occur on one computer, follows to choose one-user databases. In the event of collective using a database, choice of architecture depends on the type of work with the database. If users will only view, and at qualification of programmers insufficiently high, follows to choose a system with collective using the files. Advise you be always configured for the architecture a client-server as the most perspective and universal, in spite of that it little more complex in realization.
2. Choice of Engine and format of database.
Your database can is kept in any format, with which operate Delphi. On our mine the most suitable is a format Paradox (files *.db). This "native" format Delphi, in the system there is built-in editor of databases of format *.DB. Except this, you does not take in addition to connect ODBC driver.
Engine of database we name a system, ensuring work with data on low level. "Native" is BDE (Borland Database Engine), last version which 5.01.
BDE has much value and defects. Main defect is that except program will come put a client with BDE, which will occupy more spaces diskettes. To avoid this defect possible or carry with itself necessary libraries (dll files) or use an alternative other companies engine (particularly when working with formats of databases, different from *.db).
Below brought necessary file list, which is replaced installation BDE on other computers:
blw32.dll, idapi32.dll, idr20009.dll, bantam.dll, charset.cvb, usa.btl + for *.db tables a file - idpdx32.dll, for *.dbf tables a file - iddbas32.dll, if use local SQL server that files - idsql32.dll and idbat32.dll
Thereby you get the whole engine a size a maximum 1.5 Mb, but in the archive 600 Kb.
Other variant is an use installations programs (type InstallShield), which will allow when making programm copies to connect to the program necessary libraries.
Alternatives BDE are: Halcyon, Flash Filler, Apollo, Titan and etc. Full list of substitutes you are to find on www.kylecordes.com server. Download their possible beside us in the section "Components" or apply to the section "References".
We advise to use BDE when working with Paradox tables (*.db).
3. Interface Development.
In the first we advise you will be define with the amount of the screen forms in your applition, then define, what elements on them will be locate. Don`t forget on "golden rule": not more 7 of elements on the form.
Under the most broad choice "native" visual and nonvisual components in Delphi, even their not always can be enough, or some from them you can than-that not to make. Do not hurry to write own components, but view it in our collection in the section "Components". Here present Russian and other developments: complement standard components and components, not having analogue in Delphi.
Advise you do an interface of your program non-standard, this will do a program more attractive and interesting.
4. Writing a program.
When writing a programme code on Delphi, aside from the reference system, you can will be useful special literature. Particularly this concerns one, wants to use in their own applications SQL, but from data by language practically not sign. Reference system Delphi advises developers of programs on this cause much scanty. But meantime, SQL - very suitable facility! Advise you its actively use. Book "Understanding SQL" (Martin Gruber) and other literature to to you much will powerfully help. Remember that local version SQL from Borland Delphi has an ensemble of restrictions, on which you are to read in the file of help localsql.hlp, inhere usually in the file "Program Files\Common Files\Borland Shared\BDE\".
When working with databases on Delphi possible use two components: Table and Query. We advise to use Query, this will give you a possibility more flexible with other software.
5. How do installation pack.
If you want to do installation version of your programm, use special programs of type InstallShield, Wise. Reduce a size your *.exe file and dynamic libraries possible by means of programs-packers UPX and ASPACK. Size of file decreases, but start occurs quicker to the account of sensing from the disk. We consider that this very nonbad output, particularly, if your programs will spread on network.
We hope that components and information, as well as our advices, which you will here find, will render you immeasurable a help.
Successful you developments and in all good luck.
Respectfully yours DAO & Konfetka
P.S. We search for a work outside Russia. Write us their own offers on work.