getByte TINYINT(1): java.lang.ClassCastException: java.lang.Short
Posted by:
Liu Yan
Date: January 07, 2005 08:29AM
Hi, I have a field which type is TINYINT(1), and when I use "ResultSet.getByte()" to get the value, I encounter an exception:
java.lang.ClassCastException: java.lang.Short
at com.mysql.jdbc.ResultSet.getNativeByte(ResultSet.java:4172)
at com.mysql.jdbc.ResultSet.getByte(ResultSet.java:729)
at com.mysql.jdbc.ResultSet.getByte(ResultSet.java:742)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getByte(DelegatingResultSet.java:230)
at org.tangniaobing.database.UserDB.BindDataToUser(UserDB.java:369)
......
Environment:
-------------------------------
MySQL: 4.1.8 nt
Connector-J: 3.1.6
WebServer: Tomcat 5.5.4
JDK: Sun JDK 5.0 Update 1 (1.5.0_01)
+---------------------+-----------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------------+-----------------------+------+-----+---------------------+----------------+
| Gender | tinyint(1) unsigned | | | 0 | |
+---------------------+-----------------------+------+-----+---------------------+----------------+
-------------------------------
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 ?
Subject
Written By
Posted
getByte TINYINT(1): java.lang.ClassCastException: java.lang.Short
January 07, 2005 08:29AM
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.