Subject | RE: [firebird-support] Embedded Firebird 2.1.1 keeps the database file opened |
---|---|
Author | Alan McDonald |
Post date | 2008-08-21T22:53:19Z |
> > HelloI don't use this lib. I use IBO exclusively. So I can't offer experience in
> >
> > 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
>
> The Disconnect method in FBLib, in turn, is:
>
> procedure TFBLDatabase.DoDisconnect;
> var
> Status_vector: ISC_STATUS_VECTOR;
> begin
> CheckConnected;
> isc_detach_database(@Status_vector, @FDBhandle);
>
> if FDBHandle <> nil then FBLShowError(@Status_vector);
> end;
>
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