Bug #848 Large data is truncated while fetching from LONGBLOB field.
Submitted: 15 Jul 2003 6:52 Modified: 15 Aug 2004 22:42
Reporter: Rodion Alukhanov Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S3 (Non-critical)
Version:3.0.8 OS:Windows (Windows 2000)
Assigned to: Mark Matthews CPU Architecture:Any

[15 Jul 2003 6:52] Rodion Alukhanov
Windows 2000 SP3 (and Windows NT SP6a), mySQL 4.0.13, JDBC 3.0.8

I have table with LONGBLOB field. I can store quite large file in this table. I put and get files by Control Center 0.9.2 and JDBC connector. Everything is OK until file size is less than about 15Mb.

When I try to get file with large size, data in this file is shifted right for 4 byte. For Example:

Original data: 123456789....123456789
I get:         0000123456789....12345

there 0 is 00F bytes. So, I lose last 4 bytes and get 4 null-byte in the beginning of file.

This happens only while getting file by JDBC. If I get file by CC - file is received without truncation. I also can put file by JDBC and get file by CC. So, I think that this bug is the bug of JDBC driver.

I tried to fetch data as by ResultSet.getBinaryStream(), as by ResultSet.getBinaryData() method. File is truncated in both cases.

Again, this problem is happens only if file is more than about 15Mb.

...sorry for poor English...

How to repeat:
1. Create table with LONGBLOB
2. Put there file with size 20Mb
3. Try to fetch this file by JDBC connector
4. Compare fetched file and original one
[15 Jul 2003 8:23] Mark Matthews
Thank you for your bug report. This was a regression from 3.0.7 to 3.0.8, and is now fixed for 3.0.9.
[16 Jul 2003 4:53] Rodion Alukhanov
And where (or when) can I find version 3.0.9? There are only 3.0.8 and 3.1.0-alpha on the mySQL site...
[16 Jul 2003 5:26] Mark Matthews
3.0.9 will be released at the same time as MySQL-4.1.1 (or slightly before) as MySQL-4.1.1 has some changes pending that will affect both Connector/J 3.0.x and Connector/J 3.1.x. If you need a version sooner, please contact me through the bugs system.
[16 Jul 2003 6:32] Rodion Alukhanov
I tried to use version 3.0.7. It also don't work with LONGBLOB fields because of another bug. It was fixed in version 3.0.8, so I didn't report about it.

Yes. It would be very good to get version 3.0.9 sooner. Could you send it to me?

[21 Jul 2003 11:13] Mark Matthews
You can get the latest nightly snapshot with the fix applied at http://mmmysql.sourceforge.net/snapshots/stable/
[15 Aug 2004 19:42] Sylvain Vittecoq
I also need to load long blobs from Mysql and the shift of 4 bytes occurs
when the blob is bigger than 15 MBytes in the following 4 versions of the Connector :


I run Mysql 4.0.18 Standard with Java 1.4.2_03-b02 on Linux.

Do you know which version I should use ?

Any help would be very much appreciated,

Thanks, Sylvain.
[15 Aug 2004 22:42] Mark Matthews
Are you _absolutely_ sure you don't have an older version of the JDBC driver laying around in your CLASSPATH?

I've just tested this with all of the versions mentioned and the problem you describe doesn't occur. Testing this behavior has been a part of the regression testsuite that is performed on every check-in automatically by our build system since the bug was reported fixed (but I tested by hand as well).