From: Calistra Research Labs Date: February 8 2000 3:00am Subject: Inserting Blobs List-Archive: http://lists.mysql.com/java/702 Message-Id: <200002080301.LAA27733@helium.singnet.com.sg> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT I am using the following code to try to insert images of over 70K- but the code dies on the update command. It dies either with the commented code (setBytes) or the uncommented code (setBinaryStream) pStmt = new org.gjt.mm.mysql.PreparedStatement( Conn, "update pictures set image_data=? where id=?",""); picFile = new File("d:\\catalog\\" + image_filename); picFileLength = picFile.length(); label_1.setText( "transfer file to DB "+picFileLength); picFileStream = new FileInputStream( picFile ); /* picArray = new byte[ (int)picFileLength ]; result = picFileStream.read( picArray, 0, (int)picFileLength ); picFileStream.close(); pStmt.setBytes(1,picArray); */ pStmt.setBinaryStream(1,picFileStream,(int)picFileLength); pStmt.setInt(2,id); pStmt.executeUpdate(); Debug log connecting to localhost:7777 java.lang.ArrayIndexOutOfBoundsException at org.gjt.mm.mysql.Buffer.writeBytesNoNull(Buffer.java:352) at org.gjt.mm.mysql.PreparedStatement.executeUpdate(PreparedStatement.java:291) at MainForm.MainForm_objectCreated(MainForm.java:341) at MainForm.create(MainForm.java:196) at PortfolioMySQL.createAppletForm(PortfolioMySQL.java:24) at PortfolioMySQL.init(PortfolioMySQL.java:19) at sun.applet.AppletPanel.run(AppletPanel.java:286) at java.lang.Thread.run(Thread.java:466) Dave Appleton Calistra Research Labs Pte Ltd Pager : 9-327-9-739 111 North Bridge Rd #21-01 Fax : 756-6058 Peninsular Plaza Singapore 179098 Machine Vision Systems Republic of Singapore Interactive Voice Response Systems Development IT Consultants & Custom Software Development mySQL Database Consultants / Developers