Subject Re: [Firebird-Java] Re: TypeConvertionException
Author Carsten Schäfer
----- Original Message -----
From: "rrokytskyy" <rrokytskyy@...>
To: <Firebird-Java@yahoogroups.com>
Sent: Tuesday, April 02, 2002 5:52 PM
Subject: [Firebird-Java] Re: TypeConvertionException


> > 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.
>

I 've changed all my getFloat to (float)rs.getDouble and now it works.
So i think all my values are 'castable'.

gruse
Carsten