Subject RE: [firebird-support] Embedded Firebird 2.1.1 keeps the database file opened
Author Alan McDonald
> 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
> opened.
> I use
> gfix -force 1 -shut dbFile.fdb
>
> That is I use TFBLService.GFixSetShutdownDb(dbFile.fdb, 1), which is
> the
> equivalent
> API call in FBLib.
>
> The database file is still opened by the library after that. I even
> tried to
>
> FreeLibrary(hDLL)
>
> which, apart from the fact that it later crashes my app, still keeps
> the new
> database opened, even though the debugger says 'Module unload:
> fbembed.dll
> ...' at the time I call FreeLibrary. The only way to release the file
> is to
> exit my process.
>
> How can I create a database and then move it or delete it ?
> Is this a known issue ? Is this by design ?
>
> It would be awful to create a new process, transparent to the user,
> that
> would load the library and receive db requests from the main app by
> pipes or
> shared memory, just to be able to release the file.
>
> Has anyone had this problem before ? It is really frustrating ...
>
> Thank you,
> Timothy Madden

I don't have this problem. Are you sure you are disconnecting from the
database?
What components are you using?
Alan