getObject() in Connection/J driver throws Exception on large unsigned bigints
am 27.01.2003 23:57:13 von kathyvs
Description:=20
If a table contains and unsigned bigint column, and a row contains
a value that is larger than a valid signed bigint value, then
getObject() in JDBC will throw an exception because it calls
getLong() which is not valid for this type of column in this
range
This appears to be a bug in the Connector Driver, not in MySQL
itself =20
I did a search on the MySQL site (now that the driver is there)
and did not find any help (beyond the note in the standard
documentation about roundoff errors with these numbers)
How-To-Repeat:
I've placed a program at
http://wwwcscmuedu/~kvs/UnsignedLongTestjava
that shows the problem To see the problem run it as follows:
java UnsignedLongTest []
The default url is jdbc:mysql://localhost/test
When I run the test (on MySQL version 409-gamma-nt and Driver
version 305-gamma on a Dell machine running Windows 2000), I get=
the following result:
Checking value when read as string
Expected value found
Checking value when read as object
javasqlSQLException: Invalid value for getLong() - '9223372036854775=
907'
=09at commysqljdbcResultSetgetLong(ResultSetjava:13 44)
=09at commysqljdbcResultSetgetObject(ResultSetjava: 1440)
=09at commysqljdbcResultSetgetObject(ResultSetjava: 1545)
=09at UnsignedLongTestfindTestData(UnsignedLongTestjava:63)
=09at UnsignedLongTestrun(UnsignedLongTestjava:31)
=09at UnsignedLongTestmain(UnsignedLongTestjava:116)
Exception in thread "main"=20
Fix:
I do not know a way to fix the problem, but one can of course use
getBigDecimial or getString and retrieve the value
Synopsis:=09getObject() throws an exception with very large unsigned bigin=
ts
Originator:=09Kathy Van Stone
Organization: Productsoft Inc
MySQL support: none
Severity:=09non-critical
Category:=09MySQL Connector/J
Class: sw-bug
------------------------------------------------------------ --------
mail2web - Check your email from the web at
http://mail2webcom/
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread13605@lists.mysql.com
To unsubscribe, e-mail
Re: getObject() in Connection/J driver throws Exception on largeunsigned bigints
am 28.01.2003 05:07:49 von Mark Matthews
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
kathyvs@adelphia.net wrote:
> Description:
>
> If a table contains and unsigned bigint column, and a row contains
> a value that is larger than a valid signed bigint value, then
> getObject() in JDBC will throw an exception because it calls
> getLong() which is not valid for this type of column in this
> range.
>
>
> This appears to be a bug in the Connector Driver, not in MySQL
> itself.
>
> I did a search on the MySQL site (now that the driver is there)
> and did not find any help (beyond the note in the standard
> documentation about roundoff errors with these numbers).
>
> How-To-Repeat:
>
> I've placed a program at
>
> http://www.cs.cmu.edu/~kvs/UnsignedLongTest.java
>
> that shows the problem. To see the problem run it as follows:
>
> java UnsignedLongTest []
>
> The default url is jdbc:mysql://localhost/test.
>
> When I run the test (on MySQL version 4.0.9-gamma-nt and Driver
> version 3.0.5-gamma on a Dell machine running Windows 2000), I get
> the following result:
>
> Checking value when read as string
> Expected value found.
> Checking value when read as object
> java.sql.SQLException: Invalid value for getLong() - '9223372036854775907'
> at com.mysql.jdbc.ResultSet.getLong(ResultSet.java:1344)
> at com.mysql.jdbc.ResultSet.getObject(ResultSet.java:1440)
> at com.mysql.jdbc.ResultSet.getObject(ResultSet.java:1545)
> at UnsignedLongTest.findTestData(UnsignedLongTest.java:63)
> at UnsignedLongTest.run(UnsignedLongTest.java:31)
> at UnsignedLongTest.main(UnsignedLongTest.java:116)
> Exception in thread "main"
>
>
> Fix:
>
> I do not know a way to fix the problem, but one can of course use
> getBigDecimial or getString and retrieve the value.
>
> Synopsis: getObject() throws an exception with very large unsigned bigints.
> Originator: Kathy Van Stone
> Organization: Productsoft Inc.
> MySQL support: none
> Severity: non-critical
> Category: MySQL Connector/J
> Class: sw-bug
>
>
> ------------------------------------------------------------ --------
> mail2web - Check your email from the web at
> http://mail2web.com/ .
>
>
>
> ------------------------------------------------------------ ---------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail bugs-thread13605@lists.mysql.com
> To unsubscribe, e-mail
>
Thanks for your bug report. This will be fixed in Connector/J 3.0.6.
-Mark
- --
MySQL 2003 Users Conference -> http://www.mysql.com/events/uc2003/
For technical support contracts, visit https://order.mysql.com/?ref=mmma
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE+NgIYtvXNTca6JD8RAjZ1AJ0Rb/JH1eiXEqCwlCCkeuYUBpTRWwCg iMh4
gQEbcVYgOtDkDKbYbUmRIsk=
=zp5r
-----END PGP SIGNATURE-----
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread13608@lists.mysql.com
To unsubscribe, e-mail