Re: getByte TINYINT(1): java.lang.ClassCastException: java.lang.Short
Posted by: Mark Matthews
Date: January 07, 2005 09:30AM

Liu Yan wrote:
> Hi, I have a field which type is TINYINT(1), and
> when I use "ResultSet.getByte()" to get the value,

[snip]
> by the way:
> When I use Connector-J 3.0.16 & J2SDK1.4.2_06
> & Tomat 5.0.30, these code runs OK.
>
> Is it a BUG or what ?

Liu,

3.1.x aliases TINYINT(1) to the BIT type (because the server itself aliases BIT to TINYINT(1), and thus the java type that is used is Boolean).

Either make your column TINYINT(something > 1), or add the connection property 'tinyInt1isBit=false' to your JDBC URL.

It's always good to read the CHANGES file when upgrading, this is in there :)

"Made TINYINT(1) -> BIT/Boolean conversion configurable via 'tinyInt1isBit'
property (default 'true' to be JDBC compliant out of the box)."

I'll add this to the 'For upraders' section of the manual though, so it's easier to find.

-Mark

"

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: getByte TINYINT(1): java.lang.ClassCastException: java.lang.Short
January 07, 2005 09:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.