Subject Re: [Firebird-Java] Detecting server version using jaybird 2.2
Author Mark Rotteveel
On 2017-07-07 08:54, 'Steffen Heil (Mailinglisten)'
lists@... [Firebird-Java] wrote:
> Hi
>
>
> As we are moving from firebird 2.0 (!) to firebird 3 at the moment,
> there are a few places where we need to know which firebird server
> version we are connected to.
> (For example to use ALTER statements instead of writing to RDB tables.)
>
> How can that be done with jaybird?

For Jaybird 3 you could do some of these things using
org.firebirdsql.util.FirebirdSupportInfo (although the specific case
above isn't covered by an explicit method).

> Especially using 2.2, as we currently cannot move to 3.0 because we
> still depend on FBWrappingDataSource.

For Jaybird 2.2, the easiest way is probably DatabaseMetaData:
getDatabaseMajorVersion() and getDatabaseMinorVersion(), or
getDatabaseProductVersion() which produces a string with the full
Firebird version. For this last method you can use
GDSServerVersion.parseRawVersion(String) to parse this string to a
GDSServerVersion, which gives you limited functionality to compare
versions. There are other ways, but those are not easily accessible when
using FBWrappingDataSource.

Mark