1 message in com.mysql.lists.javaRe: Inserting Blobs-Images Blobs| From | Sent On | Attachments |
|---|---|---|
| Carlos Proal | 07 Feb 2000 21:56 | .txt |
| Subject: | Re: Inserting Blobs-Images Blobs![]() |
|---|---|
| From: | Carlos Proal (pro...@hotmail.com) |
| Date: | 02/07/2000 09:56:15 PM |
| List: | com.mysql.lists.java |
| Attachments: |
Dear Dave and Paolo:
Im attaching part of my currently code used to update different values (including images, in fact every file); im using an special class containing couples column-value (SQLArguments), Dave im using a different kind to contruct the preparedStatement so check it out. The example also works with inserts, changing update... to insert into ...; also im not using the ? inside the where clause but i dont think this is the problem with you.
If you have any questions please feel free to email me :)
P.D. Dont forget to create tables like: create table figure(image blob); The size is not a problem im using animated gifs around 500kb the blob size is about 65555(2^16 -1 )
From: "Calistra Research Labs" <da...@calistra.com>
Reply-To: da...@calistra.com To: "'ja...@lists.mysql.com'" <ja...@lists.mysql.com> Subject: Inserting Blobs Date: Tue, 8 Feb 2000 11:00:49 +0800
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
--------------------------------------------------------------------- Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before posting. To request this thread, e-mail java...@lists.mysql.com
To unsubscribe, send a message to the address shown in the List-Unsubscribe header of this message. If you cannot see it, e-mail java...@lists.mysql.com instead.
______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com





.txt