| Bug #2916 | SQLException: Invalid value for getInt() - 'att...' when downloading large blob | ||
|---|---|---|---|
| Submitted: | 21 Feb 2004 10:01 | Modified: | 2 Mar 2004 12:19 |
| Reporter: | Ralf Hauser | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | connector-java-3.1-nightly-20040221-bin. | OS: | Linux (RH 9) |
| Assigned to: | Mark Matthews | CPU Architecture: | Any |
[21 Feb 2004 10:30]
Mark Matthews
Make absolutely sure you're actually using the version you reported (i.e. not something else pulled in by some JRE ext/lib classloader, stray .jar file on the classpath, etc). This bug (1576) was fixed in 3.0.10, and the change propagated to 3.1.x. Can you test with Connector/J 3.0.11 to see if it happens there as well?
[21 Feb 2004 22:06]
Ralf Hauser
Mark, is there a command similar to dataSource.getDriverClassName() that gets me the driver version for a log.debug - e.g. getDriverVersion? With mysql-connector-java-3.0.11-stable-bin.jar, the problem is NOT there and I got my 46 MB (after both Tomcat AND Mozilla dieing and me putting into catalina.sh: JAVA_OPTS=-Xmx512m ) nicely out of the DB! ==> seem to be a regression in the 3.1-nightlies ...
[2 Mar 2004 12:19]
Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html
Additional info:
Please see the nightly build for 03-Mar after 00:00 GMT.

Description: java.sql.SQLException: Invalid value for getInt() - 'attachments.zipapplication/zipþ$ÄPK' at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1217) at com.mysql.jdbc.ResultSet.getInt(ResultSet.java:1233) at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:220) at com.privasphere.privalope.db.MySqlSystem.getAttachment(MySqlSystem.java:3715) Admitted, we are testing the boundaries. After the usual iteration until in my.cnf set-variable = max_allowed_packet=70M we got 45 MB into the DB quite nicely (at least the overall size of the table file indicates that it worked.) But when retrieving with the below query, we get this error. With about 13.6 MB - all works fine! The DBMS appears to be 4.0.13 on linux. First I thought this may be a AES decryption problem, but at least the error text is intelligible (the content have the filename "application.zip"). Somehow, it is changing the field boundaries in the query result. Any hints how to solve this would be highly appreciated. How to repeat: the code calling it: selAttachmentStmt = conn.prepareStatement( " SELECT " + TBL_ATTACHMENT + ".attachment_id, " + " file_size, " + " file_name, " + " content_type, " + " AES_DECRYPT(file_data_blob,?) AS file_data_blob " + " FROM " + TBL_ATTACHMENT + " , " + TBL_MSG2ATTA + " WHERE " + TBL_MSG2ATTA + ".msg_id = ? " + " AND " + TBL_ATTACHMENT + ".attachment_id = " + TBL_MSG2ATTA + ".attachment_id ;"); selAttachmentStmt.setString(1, Globals.getInstance().getAESkey()); selAttachmentStmt.setInt(2, msgId.intValue()); // msg_id if (showAESqueries) { log.debug( "selAttachmentStmt: " + ((DelegatingPreparedStatement) selAttachmentStmt) .getDelegate() .toString()); } crs = selAttachmentStmt.executeQuery(); if (crs == null) { log.debug("row set is null!"); } if (!crs.next()) { log.debug(NO_MORE_SEL_RESULTS + i); throw new DatabaseException( "No attachment found for msg: " + msgId); } else { do { i++; atta = new Attachment(); atta.setAttachmentId( new Integer(crs.getInt("attachment_id"))); atta.setFileSize(new Integer(crs.getInt("file_size"))); atta.setSizeKB(atta.getFileSize()); atta.setFileName(crs.getString("file_name")); //LINE 3715 atta.setContentType(crs.getString("content_type")); atta.setFileStream(crs.getBinaryStream("file_data_blob")); } while (crs.next()); Suggested fix: ?