Support for TIMESTAMP_WITH_TIMEZONE in ResultSet#getString()
Philippe Marschall
pm at netcetera.ch
Fri Nov 16 17:01:36 UTC 2018
On 16.11.18 16:50, Lukas Eder wrote:
> Hello,
>
> I've noticed that the table B 6 of the JDBC 4.3 spec doesn't specify that
> ResultSet.getString() should be able to produce string versions of the
> TIMESTAMP_WITH_TIMEZONE and TIME_WITH_TIMEZONE data types despite table B 5
> allowing to call setObject() with Offset[Date]Time types on CHAR and
> VARCHAR columns.
>
> Usually, drivers always support calling getString() on any data type. The
> not so unreasonable default implementation being String.valueOf(Object).
Speaking of which, to the best of my knowledge the format of calling
#getString() on a TIMESTAMP column is not specified. Do you propose to
specify it as java.sql.Timestamp#toString()? which is
yyyy-mm-dd hh:mm:ss.fffffffff
I am asking because the follow up question is what the result of calling
#getString() on a TIMESTAMP WITH TIME ZONE column should be. The obvious
candidate being java.time.OffsetDateTime#toString() is specified to be
one of
uuuu-MM-dd'T'HH:mmXXXXX,
uuuu-MM-dd'T'HH:mm:ssXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSSSSXXXXX
uuuu-MM-dd'T'HH:mm:ss.SSSSSSSSSXXXXX
with the biggest difference of the T instead of the space between the
date and time format.
Cheers
Philippe
More information about the jdbc-spec-discuss
mailing list