Build: NetBeans IDE 7.0 Beta (Build 201011152355)
VM: Java HotSpot(TM) Client VM, 17.1-b03, Java(TM) SE Runtime Environment, 1.6.0_22-b04
GUEST: executing mysql select query (probably with bad data in database)
GUEST: quando n
Created attachment 104095 [details]
Created attachment 104173 [details]
Patch for the reading part
This seems to be related to mysql reporting an UNSIGNEND INT Column as SQL-Type INTEGER. According to the JDBC Spec the default map of this type is int, but this only works for SIGNED INTEGER Columns.
My proposal would be to change the mapping in DBReadWriteHelper.java for the INTEGER, SMALLINT and TINYINT to switch to the next bigger datatype (short -> int -> long).
The attached patches fixes at least the reading side and should work.
Created attachment 104175 [details]
Patch for reading and writing
The attached patches works for me as expected. It unifies the handling of the datatypes (TINYINT, SMALLINT, INT). The verification is more lax with respect to values in the range MAX_DATATYPE + 1 to (2 * MAX_DATATYPE - 1).
This can serve as a test-case against a mysql database:
drop table t2;
CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment,
t int unsigned,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
insert into t2 (t) VALUES (2147483680);
select * from t2;
Run in the db dataview in Netbeans 6.9.1 (unpatched) reuslts in this message:
Error code 0, SQL state 22003: '2.14748368E9' in column '2' is outside valid range for the datatype INTEGER.
Run in the db dataview in my patched Netbeans 7-beta installation, I get the expected listing.
matthias, thanks a lot for the patch, has been applied in core-main/rev/20b9e61ffa15 changeset.
Ccing Jirka, Jirka, please add this fix into list of community contributions.
Integrated into 'main-golden', will be available in build *201101290000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Jiri Rechtacek <firstname.lastname@example.org>
Log: #193414: com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: '2.14748365E9' in column '1' is outside valid range for the datatype INTEGER;
applied matthias42's patch
Thanks guys. Added to list  of community fixed bugs. Great job Matthias!
I'm sorry but i don't know how to apply the patch to netbeans!