This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 193414 - com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: '2.14748365E9' in column '1' is outside valid range for the datatype INTEGER.
Summary: com.mysql.jdbc.exceptions.jdbc4.MySQLDataException: '2.14748365E9' in column ...
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Show Data (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: NETFIX
Depends on:
Blocks:
 
Reported: 2010-12-14 21:09 UTC by matthias42
Modified: 2012-04-03 16:22 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 163877


Attachments
stacktrace (1.90 KB, text/plain)
2010-12-14 21:09 UTC, matthias42
Details
Patch for the reading part (1.67 KB, patch)
2010-12-16 21:39 UTC, matthias42
Details | Diff
Patch for reading and writing (6.05 KB, patch)
2010-12-16 22:44 UTC, matthias42
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matthias42 2010-12-14 21:09:14 UTC
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
OS: Linux

User Comments:
GUEST: executing mysql select query (probably with bad data in database)

GUEST: quando n
Comment 1 matthias42 2010-12-14 21:09:17 UTC
Created attachment 104095 [details]
stacktrace
Comment 2 matthias42 2010-12-16 21:39:09 UTC
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.
Comment 3 matthias42 2010-12-16 22:44:52 UTC
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).
Comment 4 matthias42 2010-12-17 17:58:30 UTC
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.
Comment 5 Jiri Rechtacek 2011-01-28 17:32:09 UTC
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.
Comment 6 Quality Engineering 2011-01-29 05:26:30 UTC
Integrated into 'main-golden', will be available in build *201101290000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/20b9e61ffa15
User: Jiri Rechtacek <jrechtacek@netbeans.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
Comment 7 Jiri Kovalsky 2011-02-10 13:36:51 UTC
Thanks guys. Added to list [1] of community fixed bugs. Great job Matthias!

[1] http://wiki.netbeans.org/NetFIXIssues
Comment 8 Maice 2012-04-03 16:22:57 UTC
I'm sorry but i don't know how to apply the patch to netbeans!