Subject RE: [Firebird-Java] Conversions by ResultSet.getter Methods
Author Rick DeBay
I was hoping to get back the ascii value of the character. It probably
makes more sense to get back a numeric value.
The problem I have is that I quickly wrote a class that, given a
ResultSet and an object, will use introspection on the object to know
how to get column values from the ResultSet and set them on the object.
If the matching setter for the object takes a char, there is no output
from a ResultSet getter that I can pass in directly to the setter.

BTW, what do you mean by "even more?" I can extend this class to take
advantage of Jaybird enhancements.

-----Original Message-----
From: Roman Rokytskyy [mailto:rrokytskyy@...]
Sent: Friday, November 19, 2004 4:02 PM
Subject: Re: [Firebird-Java] Conversions by ResultSet.getter Methods

> 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
> byte. Y
> According to
> 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(

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


Yahoo! Groups Links