Subject Re: [Firebird-Java] Get ODS version
Author Mark Rotteveel
On 14 Aug 2014 23:24:52 -0700, "hugo.larson@... [Firebird-Java]"
<Firebird-Java@yahoogroups.com> wrote:
> Hello,Is there a way to get the ODS version of the database file
currently
> used?My problem is that we are migrating many databases at customer
sites
> from FB 1.5 to 2.5 and it happens that we forget to convert the database
> file to 2.5.Its possible to connect to an old file with 2.5 engine but
with
> side some effects.I need detect if an old file is used.Thanks,Hugo

You can obtain this from the database metadata:
http://www.firebirdsql.org/file/documentation/drivers_documentation/java/2.2.5/docs/org/firebirdsql/jdbc/FirebirdDatabaseMetaData.html#getOdsMajorVersion--
http://www.firebirdsql.org/file/documentation/drivers_documentation/java/2.2.5/docs/org/firebirdsql/jdbc/FirebirdDatabaseMetaData.html#getOdsMinorVersion--

In code:

Connection connection = ....
FirebirdDatabaseMetaData dbmd =
connection.getMetaData().unwrap(FirebirdDatabaseMetaData.class);
// or: FirebirdDatabaseMetaData dbmd = (FirebirdDatabaseMetaData)
connection.getMetaData()
int odsMajor = dbmd.getOdsMajorVersion();
int odsMinor = dbmd.getOdsMinorVersion();

Mark