What is ODS version and how to retrieve it?

ODS (on-disk structure) is a number representing version of the database physical layout structure. When a new feature is added to the Firebird it might or might not require the structure of system tables (database metadata) to change. If it does, the ODS number must increase.

This number is checked upon connection, so that server makes sure it can 'understand' the database structure. For example, when you try to connect with 1.0 server to a database created with Firebird 2.0, you'll get the error as 1.0 server is not able to handle that ODS - simply because there are fields whose meaning it does not understand.

To retrieve it you can use the Firebird API, or simply use the tool that reads it for you (it's on properties page of each database in FlameRobin). If you only have command-line access you can use Firebird's gstat command line tool (located in bin directory). Its option -h outputs the header page information, which contains the ODS:

gstat -h employee.fdb

Database "examples/empbuild/employee.fdb"
Database header page information:
Flags 0
Checksum 12345
Generation 888
Page size 4096
ODS version 11.1
Oldest transaction 181
Oldest active 818
Oldest snapshot 818
Next transaction 819
Bumped transaction 1
Sequence number 0
Next attachment ID 68
Implementation ID 19
Shadow count 0
Page buffers 0
Next header page 0
Database dialect 3
Creation date May 27, 2008 8:28:04

Variable header data:

As you can see, ODS version is 11.1 in the above example.

Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.

All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.

Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

 Installation and setup
 Backup and restore
 Connectivity and API
 Errors and error codes