Subject Re: [firebird-support] Embedded Firebird 2.1.1 keeps the database file opened
Author Timothy Madden
> > Hello
> >
> > I started use embedded Firebird 2.1.1 in my Delphi application (with
> > FBLib)
> > and I need to create and populate a database file, but if anything
> goes
> > wrong, an exception gets thrown, I need to close and delete the
> > database and
> > then prompt the user to try again.
> >
> > The problem is the embedded super-server keeps the newly created
> > database
> [...]
>
> I don't have this problem. Are you sure you are disconnecting from the
> database?
> What components are you using?
> Alan
>
> I am using FBLib Firbird Library v0.85
> http://fblib.altervista.org/
>
> It is a Borland Packaged Library (.bpl) of classes that call isc_
> functions
> in gds32.dll.
>
> I disconnect from the database and then free the database object:
> if (db <> nil) and db.Connected then
> begin
> db_name := db.DBFile;
> db.DBFile := '';
> db.Disconnect;
> db_service.GFixSetShutDownDb(db_name, 1);
> Sleep(1500); // Wait a little for the db to shut down
> FreeAndNil(db);
> end
> [...]

I don't use this lib. I use IBO exclusively. So I can't offer experience in
the use if these calls.
I see, though, that the Destroy procedure also disconnects from the service
manager, which suggests that a connection makes this attachment by default.
Also not sure about the shutdown logic here (above).
I never shut my databases down (using embedded). Doesn't make sense since
you are the only connection anyway. But the shutdown itself requires a
persistent connection to ensure no new connections are established. So where
is the logic in all this?
Alan



Well I am now thinking I also use IBExpert as a GUI for my database for
testing,
and I do not remember IBExpert having this problem ... Maybe it is indeed
FBLib;
now I am not even sure ! I shortly looked over the connect sequence in FBLib
and I saw no file being opened though .... I will have to check again
IBExpert and
FBLib.

The shut down and service manager connection I have only recently added in
my
code hoping that this will have some effect and close the (FBLib ?) handles
on the
database files.

Thank you,
Timothy Madden,
Romania


[Non-text portions of this message have been removed]