2 messages in com.mysql.lists.bugsRe: getObject() in Connection/J drive...
FromSent OnAttachments
kath...@adelphia.net27 Jan 2003 14:56 
Mark Matthews27 Jan 2003 20:07 
Subject:Re: getObject() in Connection/J driver throws Exception on large unsigned bigints
From:Mark Matthews (ma@mysql.com)
Date:01/27/2003 08:07:27 PM
List:com.mysql.lists.bugs

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

kath@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 <username> <password> [<url>]

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/ .

To request this thread, e-mail bugs@lists.mysql.com To unsubscribe, e-mail <bugs@lists.mysql.com>

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

iD8DBQE+NgIYtvXNTca6JD8RAjZ1AJ0Rb/JH1eiXEqCwlCCkeuYUBpTRWwCgiMh4 gQEbcVYgOtDkDKbYbUmRIsk= =zp5r -----END PGP SIGNATURE-----