Subject Re: [firebird-support] Corrupt FDB with Firebird embedded?
Author Martijn Tonies
Hello Christian,

> we struggle with a strange problem. An application of us is running
> with Firebird embedded. It works fine for several days. Then there is
> a problem with not unique primary key.
>
> We use a generator for primary keys. Records are inserted in one table
> only. The primary key field for the table is only set by reading a
> value from the generator.
>
> The customer send us a db file with problems and there, the value of
> the generator was 2 or 3 lower than the highest value for primary keys
> in the data table.
>
> Since we are absolutely shure, that values for primary keys only come
> from reading the generator, this is a case, that should never happen.
>
> So my question is, under which circumstance is it possible, that the
> latest value of the generator is not written properly to the database
> file. I checked and "Forced write" is on for the database file.
>
> Our environment is Delphi, Dbx driver from Upscene, FB embedded 1.5.

I kinda had the same problem - also using the dbExpress driver and
Fb Embedded. Sometimes, in an application, I would get a key violation
while the key was fetched from a generator - so basically, this could
never happen.

I had the idea, that this could happen if, for example, I terminated
the application from the Delphi debugger or didn't do a TSQLConnection
disconnect, but simply closed down the application without disconnecting
properly. Somehow, I had the idea that the Embedded Firebird would
not write the generator page, for some reason, while it would write the
data pages.

Can this be the case with your application?

With regards,

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com