[DUG] Firebird connections / queries

Trevor Jones trevorj at ihug.co.nz
Wed Jul 27 16:34:09 NZST 2005


Paul,
  While it is OK to leave a connection to the database open for a very long
time, by doing so you are making things difficult for yourself.

  Metadata changes to the database often require exclusive access, so adding
a foreign key would require that your app be shut down to make the change
unless you let it disconnect when it has been idle for a while (so that you
can do overnight upgrades etc).

  Prepared queries will also have an affect on whether or not you are
allowed to do metadata changes that don't require exclusive access.

  Also, while prepared queries can often live across transaction boundaries,
if you rely on this behaviour then you are opening yourself up to all sorts
of bugs in the driver software and the engine itself.

  As far as I can recall, IBObjects was bitten badly by a bug in firebird
where IBO tried to cache statement handles (aka prepared queries) but
firebird was blithely throwing them away.  I think that this may also have
resulted in the loss of some hair on the head of Rohit.

  If you can handle these limitations, and you are also confident that you
are not going to be chewing up server resources, then you should be
quids-in.

  I have a home-grown replicator which stays connected to the database
"forever" and so far has not run into any problems

-----Original Message-----
From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz] On
Behalf Of Paul Lowman
Sent: Wednesday, 27 July 2005 3:52 p.m.
To: Delphi List
Subject: [DUG] Firebird connections / queries

Hi all

I am using Firebird / dbExpress in an industrial control application and
wondered about the following points:

Is it OK to open a connection to a database and leave it open for extended
periods (ie: days) or should I open and close the connection on demand?

Similarly is it OK to prepare queries when the app starts and leave them in
a prepared state for extended periods?

My instincts tell me that this may be a bad approach ...

Any opinions welcome ...

Cheers

Regards

Paul Lowman

paul_lowman at xtra.co.nz

_______________________________________________
Delphi mailing list
Delphi at ns3.123.co.nz
http://ns3.123.co.nz/mailman/listinfo/delphi



More information about the Delphi mailing list