Subject Re: [firebird-support] Detecting server version at application startup
Author Werner F. Bruhin
cprund wrote:
> I'd like to detect Firebird Server version (not client) version at
> startup, immediately after I open the database.
>
> I need to do this because my application requires Firebird 1.5 but
> Interbase 6 would happily open my database.
>
> Unfortunately people make mistakes and often enough my application
> ends up being paired with an Interbase 6 server! This generates some
> un-helpful error messages, like "unknown BLR". I'd like to detect
> this and put out a message.
>
> So I'm thinking of something like this. First query on application
> startup:
>
> "select current_user from rdb$database"
>
> If this fails it's Interbase 6. Stop there.
>
> But how can I test for Interbase 1.5 using such harmless queryes?
>
> Better, is there any way to see the difference betwen 1.5.3 and
> 1.5.4, so I can recomend an server upgrade?
>
I use kinterbasdb and it provides this through the services API:

Connection.getServerVersion

The getServerVersion method returns the server's version string:

from kinterbasdb import services
con = services.connect(host='localhost', user='sysdba',
password='masterkey')

print con.getServerVersion()

Output (on Firebird 1.5.0/Win32):

WI-V1.5.0.4290 Firebird 1.5

Regards
Werner