Subject | RE: [firebird-support] New to C/S and firebird |
---|---|
Author | David Cornelius |
Post date | 2004-02-24T18:54:14Z |
You might look at IBObjects (http://www.ibobjects.com/
<BLOCKED::http://www.ibobjects.com/> ). They have an easy migration path
from the BDE to C/S using InterBase or Firebird. Lots of documentation and
good examples as well--although I don't remember any that you ask for
specifically.
There are many things that are different between a "desktop" database like
Paradox and a C/S one like Firebird. A few of the "pitfalls" that you may
encounter are:
* No direct-file access *
With Paradox, you have a collection of files that the application accesses
more or less directly through the BDE. Firebird is a database engine and
manages a single file (in many cases) for all tables, indices, etc. You
send SQL commands to the database engine and it returns a result.
Therefore, you cannot simply plop down a TTable component and hook up a
TDBGrid and expect multi-directional navigation and editing. (Having said
that, IBObjects has a component to allow you to do this to easily migrate
BDE applications--but it's doing a lot of work for you underneath.) Instead
you have uni-directional (forward only) datasets and you must explicitly
formulate SQL statements for the Insert/Update/Delete actions. If you learn
Delphi's dbExpress, you'll need to study all about the TDataSetProvider and
TClientDataSet components.
* Backups *
Another issue related to "direct-file access" is that when the server is
running, you should NEVER copy the database file itself because you might
lose data. The server may be holding data in cache or not have committed a
transaction. You should stop the server first, or (better yet) do a backup
and only move the backup file around. To do a backup, you must use the
supplied utility, gbak, instead of a regular backup utility for the same
reason as mentioned above.
* Auto-increment primary keys *
Firebird does not have a field type for auto-increments. But you can easily
implement nearly the same thing using an integer field with a generator and
a trigger. IBExpert (http://ibexpert.com/) makes doing this extremely
simple.
You didn't ask about the advantages, but if you're new to C/S databases,
you'll definitely want to study and use the next two issues as well...
* Stored Procedures and Triggers *
This is the most wonderful aspect (IMHO) about moving from a desktop
database to a true database engine. Being able to move a large chunk of
your database management code into stored procedures so that it's actually
in the database cleans up your code significantly and keeps database stuff
all together (for the most part).
* Transactions *
In Paradox, like other desktop databases, every table edit is a single
action by itself and not related to other actions in the database. For
example, if you're transferring money from one bank account to another,
you'll have a debit in one and a credit in another. With Paradox, these two
actions are separate and if something fails between the two actions, you'll
end up with lost data and while the files themselves may not be corrupt, you
now have invalid data in the database. True client/server database engines
such as Firebird implement transactions where you can specify a set of
actions to be inside a transaction. You start the transaction, make all
your table edits (debit from one account, credit to the other), then end the
transaction. If something fails anywhere in between, you simply "rollback"
your transaction and it's like nothing ever happened. This increases data
validity in the database. (There could be some "pitfalls" here for poorly
designed applications--a good rule of thumb is to keep transactions as short
as possible to prevent locks.)
Of course, there's lots more--this only scratches the surface. But
hopefully, it'll get you started a little quicker.
David Cornelius
<BLOCKED::blocked::mailto:david.cornelius@...>
CorneliusConcepts.com
_____
From: ilangovans [mailto:ilangovans@...]
Sent: Monday, February 23, 2004 7:56 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] New to C/S and firebird
Hi,
I have been a member for quite some time even though I don't use
firebird. I have been using paradox for all my applications until now. Now I
feel it is time to move on to C/S and Firebird in particular. Well this is
what I need from you guys and gals...
1. What is the best way to connect to FB1.5 from Delphi 7. (or which
componet pack to use) ?
2.Does anyone know where I can get my hands on a opensource "real life"
application like Inventory or basic accounting written in Delphi and using
Firebird. This I hope will help me speedup my transiction from Paradox to
Firebird or C/S in general. (I hate that IB samples that comes with Delphi
:-( )
3.Any pitfalls that I have to watch out for?
Thanks in advance..
Regards
[Non-text portions of this message have been removed]
<BLOCKED::http://www.ibobjects.com/> ). They have an easy migration path
from the BDE to C/S using InterBase or Firebird. Lots of documentation and
good examples as well--although I don't remember any that you ask for
specifically.
There are many things that are different between a "desktop" database like
Paradox and a C/S one like Firebird. A few of the "pitfalls" that you may
encounter are:
* No direct-file access *
With Paradox, you have a collection of files that the application accesses
more or less directly through the BDE. Firebird is a database engine and
manages a single file (in many cases) for all tables, indices, etc. You
send SQL commands to the database engine and it returns a result.
Therefore, you cannot simply plop down a TTable component and hook up a
TDBGrid and expect multi-directional navigation and editing. (Having said
that, IBObjects has a component to allow you to do this to easily migrate
BDE applications--but it's doing a lot of work for you underneath.) Instead
you have uni-directional (forward only) datasets and you must explicitly
formulate SQL statements for the Insert/Update/Delete actions. If you learn
Delphi's dbExpress, you'll need to study all about the TDataSetProvider and
TClientDataSet components.
* Backups *
Another issue related to "direct-file access" is that when the server is
running, you should NEVER copy the database file itself because you might
lose data. The server may be holding data in cache or not have committed a
transaction. You should stop the server first, or (better yet) do a backup
and only move the backup file around. To do a backup, you must use the
supplied utility, gbak, instead of a regular backup utility for the same
reason as mentioned above.
* Auto-increment primary keys *
Firebird does not have a field type for auto-increments. But you can easily
implement nearly the same thing using an integer field with a generator and
a trigger. IBExpert (http://ibexpert.com/) makes doing this extremely
simple.
You didn't ask about the advantages, but if you're new to C/S databases,
you'll definitely want to study and use the next two issues as well...
* Stored Procedures and Triggers *
This is the most wonderful aspect (IMHO) about moving from a desktop
database to a true database engine. Being able to move a large chunk of
your database management code into stored procedures so that it's actually
in the database cleans up your code significantly and keeps database stuff
all together (for the most part).
* Transactions *
In Paradox, like other desktop databases, every table edit is a single
action by itself and not related to other actions in the database. For
example, if you're transferring money from one bank account to another,
you'll have a debit in one and a credit in another. With Paradox, these two
actions are separate and if something fails between the two actions, you'll
end up with lost data and while the files themselves may not be corrupt, you
now have invalid data in the database. True client/server database engines
such as Firebird implement transactions where you can specify a set of
actions to be inside a transaction. You start the transaction, make all
your table edits (debit from one account, credit to the other), then end the
transaction. If something fails anywhere in between, you simply "rollback"
your transaction and it's like nothing ever happened. This increases data
validity in the database. (There could be some "pitfalls" here for poorly
designed applications--a good rule of thumb is to keep transactions as short
as possible to prevent locks.)
Of course, there's lots more--this only scratches the surface. But
hopefully, it'll get you started a little quicker.
David Cornelius
<BLOCKED::blocked::mailto:david.cornelius@...>
CorneliusConcepts.com
_____
From: ilangovans [mailto:ilangovans@...]
Sent: Monday, February 23, 2004 7:56 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] New to C/S and firebird
Hi,
I have been a member for quite some time even though I don't use
firebird. I have been using paradox for all my applications until now. Now I
feel it is time to move on to C/S and Firebird in particular. Well this is
what I need from you guys and gals...
1. What is the best way to connect to FB1.5 from Delphi 7. (or which
componet pack to use) ?
2.Does anyone know where I can get my hands on a opensource "real life"
application like Inventory or basic accounting written in Delphi and using
Firebird. This I hope will help me speedup my transiction from Paradox to
Firebird or C/S in general. (I hate that IB samples that comes with Delphi
:-( )
3.Any pitfalls that I have to watch out for?
Thanks in advance..
Regards
[Non-text portions of this message have been removed]