Storing/extracting embedded db within .odb

Andrzej J. R. Hunt andrzej at ahunt.org
Mon Jul 8 07:19:49 PDT 2013


Hi everyone,

I'm currently trying to store / extract a firebird database file (.fdb) into/out of an odb
file (the db will be stored in a temporary file while Base is running) -- I'm somewhat unsure
about where this should be done.

For hsqldb things are done within the SDBC driver itself where the db is fooled to make
it write into the .odb rather than directly to its own file,  -- a special url is passed to
HSQLDB to write to the .odb, but this relies on the i/o being overriden to deal with writing
directly to the odb via this url -- this isn't reccomended by the firebird devs, and as far
as I can tell this is what would lead to corruption if a crash happens when the database
file within the .odb is incomplete (I've found a few reports of users where they have had
such corruption happen, no idea how common it is). Admittedly I don't entirely understand
how this driver actually works yet, so I might be missing somethign here.

It looks like one option is to do things in ODatabaseDocument: extract the db when opening an
odb file, and save it into the odb every time we save the odb, however that's a bit inelegant as
the DatabaseDocument shouldn't need to know these details.

It might be possible to do all of this within the driver itself, and then write the complete fdb
from external storage into the .odb as appropriate (transaction committed, etc.), all controlled
by the driver, which seems most sensible to me. (The Storage object is accessible from the driver,
the HSQLDB does so.)


W.r.t. to the location of the extracted firebird db: would an appropriate naming scheme be to have
e.g. ~foo.odb.fdb#  for a foo.odb (in the same directory) similarly to the lock files that are
created? (This could also allow for better recovery should we end up with similar corruption
as is apparently happening with HSQLDB if there is a complete separate db.)

Cheers,

	Andrzej









More information about the LibreOffice mailing list