19 messages in com.mysql.lists.mysqlselect blob object error in MM JDBC 1.2c
FromSent OnAttachments
Michael Widenius10 Apr 2000 05:06 
hgar...@speedline.cookson.com10 Apr 2000 09:03 
hgar...@speedline.cookson.com10 Apr 2000 10:33 
Bryan J. Opfer10 Apr 2000 10:36 
Michael Widenius10 Apr 2000 10:47 
Richard Spangenberg10 Apr 2000 12:42 
Michael Widenius10 Apr 2000 14:31 
Michael Widenius10 Apr 2000 14:42 
Michael Widenius10 Apr 2000 16:23 
Bryan J. Opfer10 Apr 2000 18:46 
Tony Shiu11 Apr 2000 01:59 
sin...@mysql.com11 Apr 2000 04:18 
sin...@mysql.com11 Apr 2000 04:32 
Bryan J Opfer11 Apr 2000 08:57 
sin...@mysql.com11 Apr 2000 09:46 
Bryan J. Opfer11 Apr 2000 15:07 
sas...@mysql.com11 Apr 2000 17:19 
sin...@mysql.com12 Apr 2000 04:59 
sin...@mysql.com12 Apr 2000 05:02 
Subject:select blob object error in MM JDBC 1.2c
From:Tony Shiu (tony@dotcomlimited.com)
Date:04/11/2000 01:59:40 AM
List:com.mysql.lists.mysql

Hi there,

I have a problem on Java version 1.1.7, MM JDBC driver 1.2c with mySQL version 3.23.13a-alpha-log. I have a table description, desc log; | Field | Type | Null | Key | Default | Extra | Privileges | +--------------+-------------+------+-----+---------------------+-----------

---- -+---------------------------------+ | logid | bigint(20) | | PRI | NULL | auto_increment | select,insert,update,references | | byteobj | mediumblob | YES | | NULL | | select,insert,update,references |

I can successfully put a file into the database, then retrieve it by using SQL statement --> "select byteobj from log where logid = '1' into dumpfile '/_PATH/try.gif';"

HOWEVER, when I try to retrieve it through MM JDBC 1.2c by using following coding

... try { Statement stmt = con.createStatement(); org.gjt.mm.mysql.ResultSet rs = (org.gjt.mm.mysql.ResultSet) stmt.executeQuery ("SELECT byteobj FROM log WHERE logid = 100"); System.out.println(" Select fileByte finished!");

} catch (Exception e)

{ System.err.println(" select query error."); e.printStackTrace(); } ...

It produces this error. Please NOTE that, the physical size of the file should be equal to 73571. I don't know why the IndexOutOfBoundsException showed the number increased by 4 bytes.

select query error. java.sql.SQLException: Error during query: Unexpected Exception: java.lang.Array IndexOutOfBoundsException message given: 73575 at java.lang.Throwable.<init>(Compiled Code) at java.lang.Exception.<init>(Compiled Code) at java.sql.SQLException.<init>(Compiled Code) at org.gjt.mm.mysql.Connection.execSQL(Compiled Code) at org.gjt.mm.mysql.Connection.execSQL(Compiled Code) at org.gjt.mm.mysql.Statement.executeQuery(Compiled Code) at myDataAccessConfig.<init>(Compiled Code) at myDataAccessConfig.main(Compiled Code)

Any advices?

Thanks in advance.

tony.