| Bug #47665 | when write a binary file(e.g a picture) into blob, exception will occurs | ||
|---|---|---|---|
| Submitted: | 28 Sep 3:09 | Modified: | 12 Oct 10:49 |
| Reporter: | Liu Changsheng | ||
| Status: | Analyzing | ||
| Category: | Connector/J | Severity: | S1 (Critical) |
| Version: | 5.1 | OS: | Microsoft Windows (xp) |
| Assigned to: | Tonci Grgin | Target Version: | |
| Tags: | binary file, BLOB, jdbc4.0 | ||
[28 Sep 3:09]
Liu Changsheng
[28 Sep 7:20]
Sveta Smirnova
Thank you for the report. Please provide values of max_allowed_packet and size of jpeg file you are trying to insert.
[29 Sep 8:13]
Liu Changsheng
max_allowed_packet :16M the size of file I try to insert:162K. actually, I tried many files with different size.but non is successful.
[1 Oct 11:46]
Tonci Grgin
Liu, this should work... Can you please do the following: o Check c/J sources, package testsuite.simple, BlobTest.java and see if it works in your environment. o Try plain Java test, apart from Tomcat and such. o Attach full test case (as well as connection string and JRE settings) I can use to check on problem.
[4 Oct 1:39]
Liu Changsheng
OK, I will do it with your instructions, and I will report the result to you as soon as possible.Thank you.
[4 Oct 5:22]
Liu Changsheng
When I run the testsuite.simple.BlobTest, Exceptions are as follows ==================================================================== .Loading JDBC driver 'com.mysql.jdbc.Driver' Done. Connected to 5.1.37-community-log Done. E Time: 11.672 There was 1 error: 1) testByteStreamInsert(testsuite.simple.BlobTest)com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ì?Nb’,n????u?·5??A$??!tK?\"O?i?\0NC4?>???w?m???A?èy?&?·_\0x???o?0????rz÷?W' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1356) at testsuite.simple.BlobTest.testByteStreamInsert(BlobTest.java:140) at testsuite.simple.BlobTest.testByteStreamInsert(BlobTest.java:126) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at testsuite.simple.BlobTest.main(BlobTest.java:79) FAILURES!!! Tests run: 1, Failures: 0, Errors: 1 ========================================================================
[4 Oct 5:58]
Liu Changsheng
My character environment are as follows,does it matter? mysql> show variables like 'character_set_%'; +--------------------------+----------------------------------+ | Variable_name | Value | +--------------------------+----------------------------------+ | character_set_client | gbk | | character_set_connection | gbk | | character_set_database | gbk | | character_set_filesystem | binary | | character_set_results | gbk | | character_set_server | gbk | | character_set_system | utf8 | | character_sets_dir | D:\project\mysql\share\charsets\ | +--------------------------+----------------------------------+ 8 rows in set (0.00 sec) mysql>
[5 Oct 12:12]
Tonci Grgin
So Liu, you actually have the same error except that some chars are different now... I would really like to see " o Attach full test case (as well as connection string and JRE settings) I can use to check on problem." now.
[6 Oct 5:02]
Liu Changsheng
I have attached the file, which includes jre setting,connction string and source code of BlobTest.java. Please check it. Thanks.
[6 Oct 5:03]
Liu Changsheng
jre settings,connection string and source code of BlobTest.java
Attachment: JRE_SETTING_AND_CONNECTIONSTRING_AND_SOURCECODE.txt (text/plain), 15.26 KiB.
[12 Oct 10:49]
Tonci Grgin
Thanks Liu.
