BigInteger support for NUMERIC columns in JDBC
pm at netcetera.ch
pm at netcetera.ch
Thu Nov 7 16:38:05 UTC 2019
Hello
Since people are reposting their suggested improvements for JDBC I'll
respost one of mine: BigInteger support for NUMERIC columns.
Officially BigInteger is only supported for BIGINT columns. If I have a
NUMBER(19) column I need to do
.getBigDecimal(x).toBigIntegerExact()
it would be more convenient if I could do
.getObject(x, BigInteger.class)
For that BigInteger would have to be supported for any DECIMAL or
NUMERIC column with a 0 scale in addition to TINYINT, SMALLINT, INTEGER,
BIGINT columns.
These column types already support Long. Long in addition supports
FLOAT, DOUBLE, BIT, BOOLEAN, CHAR, VARCHAR, LONGVARCHAR. These can be
added for consistency. Unfortunately I could find no documentation for
what should happen for Long if there is a non-zero scale.
To my understanding this needs an update to TABLE B-5.
Such a change would be source compatible and could be implemented easily
in drivers supporting multiple versions.
Philippe
More information about the jdbc-spec-discuss
mailing list