Re: JDBC and timetz again - Mailing list pgsql-jdbc

From Thomas Kellerer
Subject Re: JDBC and timetz again
Date
Msg-id 6860997a-b05f-a06a-f70c-f819f97485c6@gmx.net
Whole thread Raw
In response to Re: JDBC and timetz again  (Mark Rotteveel <mark@lawinegevaar.nl>)
Responses Re: JDBC and timetz again  (Mark Rotteveel <mark@lawinegevaar.nl>)
List pgsql-jdbc
Mark Rotteveel schrieb am 21.04.2020 um 11:02:
> Note that JDBC itself doesn't define support for java.sql.Time (or
> java.time.LocalTime) for time with time zone types (instead it maps
> to java.time.OffsetTime).
I know that JDBC doesn't support that (and I mentioned the thread were that was discussed previously) but I would
expectthe driver to at least return a value that is correct. 

The interesting thing is, that if I use ResultSet.getString() on that column I do get the correct "value", e.g. the
following:

  ResultSet rs = stmt.executeQuery("select current_time");
  rs.next();
  System.out.println("getString: " + rs.getString(1));
  System.out.println("getTime:   " + rs.getTime(1));

will print (when run at 12:26:08):

  getString: 12:26:08.275455+02
  getTime:   11:26:08

So at some point the driver does get the correct time, but the conversion to a java.sql.Time seems to lose one hour
somewhere.

Thomas





pgsql-jdbc by date:

Previous
From: Mark Rotteveel
Date:
Subject: Re: JDBC and timetz again
Next
From: Mark Rotteveel
Date:
Subject: Re: JDBC and timetz again