Subject Re: TypeConvertionException
Author rrokytskyy
> org.firebirdsql.jdbc.TypeConvertionException: Error converting to
float.
> at org.firebirdsql.jdbc.FBDoubleField.getFloat
(FBDoubleField.java:99)
> at org.firebirdsql.jdbc.FBResultSet.getFloat(FBResultSet.java:257)
> at org.firebirdsql.jdbc.FBResultSet.getFloat(FBResultSet.java:390)
>
>
> Is this a bug or a feature ?
> I think getFloat on a double field should do a normal convertion
> like:
> double d;
> float f = (float)d;

Usually it works like you expect... Here's the code that throws an
exception:

// check if value is withing bounds
if (value.doubleValue() > Float.MAX_VALUE ||
value.doubleValue() < Float.MIN_VALUE)
throw (SQLException)createException(
FLOAT_CONVERSION_ERROR).fillInStackTrace();

So, I would check if the value you supply to the JDBC driver can be
downcasted to float.

Best regards,
Roman Rokytskyy