| Bug #3850 | SQL exception setBlob array index out of bounds | ||
|---|---|---|---|
| Submitted: | 21 May 2004 16:12 | Modified: | 29 May 2004 16:53 |
| Reporter: | Susan Carswell-Hurdis | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) |
| Version: | mysql-connector 3.0.9 | OS: | Windows (Windows XP) |
| Assigned to: | CPU Architecture: | Any | |
[21 May 2004 16:15]
Susan Carswell-Hurdis
Forgot to set the priority
[29 May 2004 16:53]
MySQL Verification Team
I remember this bug and I also remember that it was fixed in later versions.

Description: I am preparing a statement for a 4.0.17 innodb database. I am trying to update a record and set a blob into a field. When I issue the command updateStatement.setBlob(1,blob) I get an Array Index Out of Bounds Exception.\ The index is 4 the length of my blob. The statements work if I use setBytes but not setBlob How to repeat: Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT percentages FROM allocation_Cycle " + "WHERE allocation_cycle_ID = " + allocationCycleRK.toString()); rs.next(); blob = rs.getBlob("percentages"); updateString = "UPDATE allocation_cycle " + " SET percentages = ? " + " WHERE allocation_cycle_id = "+ allocationCycleRK.toString(); PreparedStatement updateStatement = con.prepareStatement(updateString); byte[] stuff = new byte[4]; stuff[0] = 7; stuff[3] = 2; blob.setBytes(1,stuff); updateStatement.setBlob(1,blob); //updateStatement.setBytes(1,stuff);