首页

源码搜藏网

首页 > 开发教程 > mysql教程 >

MySQL Bugs: #2916: SQLException: Invalid value for getInt()

创建时间:2013-04-24 22:50  

[21 Feb 2004 10:01] Ralf Hauser

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:

上一篇:解决不能通过mysql.sock连接MySQL问题的办法
下一篇:Portal:MySQL

相关内容

热门推荐