Re: JDBC driver returns different version strings on Ubuntu and CentOS

From: Jorge Solórzano <jorsol(at)gmail(dot)com>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: JDBC driver returns different version strings on Ubuntu and CentOS
Date: 2018-02-19 17:04:30
Message-ID: CA+cVU8NLtWYS0M3fiUKgYTWQ9AY2KrmdMFTTC41phkxp7zifOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

The DatabaseMetaData.getDatabaseProductVersion() returns the exact string
of ParameterStatus "server_version", and this version can be different from
ditro to distro, in my Ubuntu the "server_version" returns: "10.2 (Ubuntu
10.2-1.pgdg16.04+1)". In other words the version returned is not
"parsed/cleaned", and if you need to implement some logic based on the
version, is better to use getDatabaseMajorVersion() and
getDatabaseMinorVersion().

Regards.

On Mon, Feb 19, 2018 at 9:52 AM, Thomas Kellerer <spam_eater(at)gmx(dot)net> wrote:

> I have just noticed that DatabaseMetaData.getDatabaseProductVersion()
> returns the String "10.2.2" when connected to a server running on Ubuntu,
> but returns "10.2" when connected to a server running on CentOS or Windows.
>
> Is there a specific reason for this?
>
> It's a bit confusing because 10.2.2 doesn't actually exists as a "real"
> Postgres version.
>
> This happens with the driver versions 42.1.4 and 42.2.1 (haven tried
> others)
>
> Regards
> Thomas
>
>
>
>

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Kellerer 2018-02-20 07:46:14 Re: JDBC driver returns different version strings on Ubuntu and CentOS
Previous Message Thomas Kellerer 2018-02-19 15:52:33 JDBC driver returns different version strings on Ubuntu and CentOS