Introduction
An .odb file is the document LibreOffice Base
(and Apache OpenOffice Base before it) saves. It is the OpenDocument database front end: it does not
hold a database engine’s tables in a standard way, it holds the description of a connection to a database, and
the queries, forms and reports built on it. For the common case of an embedded database the data goes into the
package as well, as the files of the HSQLDB engine (or, in newer LibreOffice, Firebird). The media type is
application/vnd.oasis.opendocument.base.
It is an OpenDocument package: a ZIP file whose first entry
is mimetype, with a META-INF/manifest.xml, a content.xml whose body is
office:database, a settings.xml, and the folders below. Everything about the package
(the manifest, encryption, signatures, macros, embedded objects) is the same as for the other OpenDocument
formats and is on the ODT pages; this format adds the
db: elements and the database files.
Structure
| Part | What it holds |
|---|---|
mimetype, META-INF/manifest.xml | The package’s media type and file list (ODF part 3). |
content.xml | The office:database body: the data source, table representations, queries, and the lists of forms and reports. Database description. |
settings.xml | View settings (the same as other OpenDocument documents). |
forms/, reports/ | Each form and report is an embedded OpenDocument document (a folder such as forms/Obj1/ with its own content.xml), named by a db:component. Queries, forms and reports. |
database/ | An embedded database: HSQLDB’s script, properties, data, backup and log, or Firebird’s firebird.fdb (and a firebird.fbk LibreOffice keeps for migration). Embedded databases. |
Basic/, Scripts/ | Macros (listed, never run). |
Configurations2/, Thumbnails/ | User interface configuration and a preview picture. |
The connection is named by db:connection-resource. sdbc:embedded:hsqldb and
sdbc:embedded:firebird mean the database inside the package; other values name an external
database (for example sdbc:mysql:jdbc:…, sdbc:odbc:… or sdbc:dbase:…
with a file path) and a file-based database or a server can be described structurally with
db:file-based-database and db:server-database. When the data is outside the package,
an .odb holds no rows at all.
In the explorer
Dropping an .odb file on the explorer opens it with the ODF viewer. The Document tab shows the data
source (connection, login, driver and application settings, the table filter and the free-form settings), the
table representations, the queries with their SQL, the forms and reports (each row opens the embedded document),
and the embedded database: for HSQLDB the tables, columns and constraints from the script, every row (read from
the script’s INSERT statements or from the binary data file), the users and settings, the
properties and the log; for Firebird (ODS 12) the header page, the relations, the columns with their stored types, and every row of the user tables. Password-protected parts, signatures,
macros and the package’s own checks are the same as for the other OpenDocument formats.
Not described
These pages follow the OpenDocument 1.3 schema for the db: elements and what was found in
LibreOffice’s own test documents; the HSQLDB and Firebird engines have their own formats, which are not
part of OpenDocument.
Known, not yet covered
- Reference: the full file formats of the two embedded engines. HSQLDB 1.8’s binary row format is described on the Embedded databases page as far as it was worked out from sample files (the row layout and the types listed there); what it does for the other index kinds, for very large tables (storage over 4 GiB), for deleted rows and free blocks is not written down. Firebird’s on-disk structure (ODS) is documented by the Firebird project; the Embedded databases page writes down the page, record and schema layouts read for ODS 12 and lists what is left (the index pages themselves, the backup format).
- Viewer: Firebird tables and rows are read for ODS 12 files (checked on LibreOffice’s one real file with one table, and the
system tables on a second real file:
core1331.fdbof Firebird’s own QA repository, ODS 11.0, Firebird 2.5, in which the relation names, ids, indexes with their segments and triggers read with the same offsets; its user table’s format descriptors do not parse, which is shown as “no usable format descriptor”, not as a value; LibreOffice’s tests hold no other raw Firebird file, only afirebird.fbkbackup). Indexes, constraints, triggers and views are listed fromRDB$INDICES,RDB$INDEX_SEGMENTS,RDB$RELATION_CONSTRAINTS,RDB$TRIGGERSand the view source ofRDB$RELATIONS: checked on the two real files for indexes and triggers (every one is a system object there) and for constraints on the ODS 12 file; no real file had a user view, a user constraint or a user trigger, so those rows are read at the offsets of the system ones. The B-tree pages of the indexes are counted, not decoded. Blobs of levels 1 and 2 are read (blob pages from the numbers in the blob record, level 2 through the pointer pages), checked on a constructed file in which the sample’s own blobs were moved onto blob pages, not on a real file with a large blob. ODS 13 (Firebird 4) is read at offsets found from the file itself (the position ofRDB$PAGESinRDB$RELATIONSandRDB$RELATION_FIELDS); no ODS 13 file was available, so that is untested. Firebird’s gbak backup (firebird.fbk) is not read; only the HSQLDB 1.8 script, properties, log and data files that LibreOffice’s test documents hold were checked, and another version’s files are not recognised as such. - Viewer: the forms and reports are listed and each embedded document opens as its own part, but they are not drawn as forms or reports.
Unknown
- Reference: what LibreOffice does with the
db:schema-definitionelement: no file in the samples read (LibreOffice’s test documents and its schema) writes one.
Links
Software
- LibreOffice Base – makes and opens these files (Windows, macOS, Linux)
- Apache OpenOffice Base – the earlier program in the same line (Windows, macOS, Linux)
Developers
Reference
- OpenDocument 1.3, part 1 – chapter 12, “Database front end documents”
- LibreOffice’s test documents – real .odb files with HSQLDB and Firebird data