Bug #10850 | setCharacterStream with empty stream results in exception | ||
---|---|---|---|
Submitted: | 25 May 2005 2:10 | Modified: | 6 Jun 2005 23:03 |
Reporter: | Chris Wood | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 3.1.8 | OS: | |
Assigned to: | CPU Architecture: | Any |
[25 May 2005 2:10]
Chris Wood
[25 May 2005 2:11]
Chris Wood
The test case.
Attachment: Blah.java (application/octet-stream, text), 1.43 KiB.
[25 May 2005 7:50]
Vasily Kishkin
Tested on Win 2000 Sp4 , JDK 1.5, MyODBC 3.51.11. Test case is attached.
[25 May 2005 7:50]
Vasily Kishkin
Test case
Attachment: test.java (text/plain), 1.54 KiB.
[25 May 2005 7:52]
Vasily Kishkin
Sorry. I did't see Chris's suit case and created mine.
[6 Jun 2005 23:03]
Mark Matthews
Fixed for 3.1.9. See the nightly snapshots at http://downloads.mysql.com/snapshots.php#connector-j
[1 Sep 2005 19:57]
Ralf Hauser
Somehow, this still appears to appear? stmt.setBinaryStream(4, new ByteArrayInputStream("".getBytes()), causes <<DEBUG [http-8443-Processor23] (DBSystem.java:1666) - (DBSystemGenericImpl.addAttachment:703) - com.mysql.jdbc.ServerPreparedStatement[294] - INSERT INTO TBL_ATTACHMENT (file_size, file_name, content_type, file_data_blob, create_id, create_date) VALUES (23,'a-1.txt','image/gif', ** STREAM DATA ** ,144,'2005-09-01 21:53:04' ) java.sql.SQLException: Incorrect arguments to mysql_stmt_execute at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2851) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531) at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1366) at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:952) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1974) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1897) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1758) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101) at com.privasphere.privalope.db.DBSystemGenericImpl.addAttachment(DBSystemGenericImpl.java:708) >> I use mysql-connector-java-3.1.10-bin.jar with jdk1.5 on redhat Linux 2.6.9-11.EL #1 Fri May 20 18:17:57 EDT 2005 i686 i686 i386 GNU/Linux with the server version 4.1.13-standard-log
[1 Sep 2005 20:18]
Ralf Hauser
stmt.setBinaryStream(4, new ByteArrayInputStream("a".getBytes()), 0); fixed it for me. correct would probably have been stmt.setBinaryStream(4, new ByteArrayInputStream("a".getBytes()), 1); (I do later update the blob with the big stream - this way the code also works for oracle)