Subject | Re: [Firebird-Java] org.firebirdsql.jdbc.field.TypeConvertionException: Error converting to long. |
---|---|
Author | Roman Rokytskyy |
Post date | 2008-07-24T09:15:53Z |
> When debugging, the rsmd.getColumnType(i) of the num15_0 fieldI would say that you get the VARCHAR there. Two reasons:
> resolves to 12, which is the constant for java.sql.Types.VARCHAR. So
> the default case of the switch-statement is called and the following
> error occurs:
> org.firebirdsql.jdbc.field.TypeConvertionException: Error converting
> to long.
> at
> org.firebirdsql.jdbc.field.FBLongField.setString(FBLongField.java:131)
> at
> org.firebirdsql.jdbc.AbstractPreparedStatement.setString(AbstractPreparedStatement.java:384)
> at
> de.indv.db.DBConnection.executePreparedStatement(DBConnection.java:129)
>
> Is there a bug in firebird/jaybird or am I doing something wrong?
a) I checked the sources, and I am pretty sure that for NUMERIC(15,0)
Jaybird would return Types.NUMERIC
b) Even if not, it would then convert the number into a String in
rs.getString() method and the ps.setString(...) would parse the number,
convert it into Long and send back to the server. Since we have no
decimal point, it will be 100% parsable. But you get an error there.
Therefore, please check the contents of the field.
If it does not work, please prepare a reproducable test case, I will
check it.
Thanks!
Roman