I am testing Firebird NUMERIC / DECIMAL fields behavior in JDBC (Jaybird) in Java.
When using FBResultSetMetaData
to check the column properties (for using ResultSet.getObject
method for e.g. SELECT * FROM NUMERICTEST
query) I get the precision (FBResultSetMetaData.getPrecision
) and scale (FBResultSetMetaData.getScale
) exactly as declared in table definition in Firebird, e.g.
NUMERIC(3,2) field ... precision 3, scale 2
DECIMAL(3,2) field ... precision 3, scale 2
When using FBParameterMetaData
to check the parameter properties (for using PreparedStatement.setObject
method for e.g. INSERT INTO NUMERICTEST VALUES (?, ?)
query) I get for the same fields different values of precision (FBParameterMetaData.getPrecision
) and scale (FBParameterMetaData.getScale
).
NUMERIC(3,2) field ... precision 4, scale 2
DECIMAL(3,2) field ... precision 9, scale 2
I know that these values correspond somehow to the internal db storage type of these fields (smallint
in the first example, integer
in the second?).
What is the reason for the different behavior of FBResultSetMetaData
and FBParameterMetaData
when related to the same field? It is quite misleading.
Java 8 u 181, Jaybird 3.0.4, Firebird 2.5