Subject Re: [Firebird-Java] Conversions by ResultSet.getter Methods
Author Roman Rokytskyy
> I'm calling ResultSet.getByte() on a field defined as CHAR(1) and
> I'm getting the exception:
>
> org.firebirdsql.jdbc.field.TypeConvertionException: Error converting to
> byte. Y
>
> According to
> http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/mapping.html#101
> 3836 drivers may support this mapping. Is it Jaybird's intention to
> support the entire table?

JayBird supports this table already (and even more). For your case it is
defined as:

public byte getByte() throws SQLException {
if (rs.row[numCol]==null) return BYTE_NULL_VALUE;

try {
return Byte.parseByte(getString().trim());
} catch (NumberFormatException nfex) {
throw (SQLException) createException(
BYTE_CONVERSION_ERROR+"
"+getString().trim()).fillInStackTrace();
}
}


However, if you have a CHAR(1) column containing "Y" as a value, converting
it to a byte seems problematic. :) Can you suggest what should be the result
of this conversion?

Roman