6 messages in com.mysql.lists.javaRE: PreparedStatement and blobs| From | Sent On | Attachments |
|---|---|---|
| Luca Lafranchi | 14 Nov 2002 05:31 | |
| Jon Frisby | 14 Nov 2002 10:01 | |
| Jon Frisby | 14 Nov 2002 15:23 | |
| David Tonhofer, m-plify S.A. | 14 Nov 2002 15:41 | |
| Jon Frisby | 14 Nov 2002 16:01 | |
| Mark Matthews | 15 Nov 2002 13:42 |
| Subject: | RE: PreparedStatement and blobs![]() |
|---|---|
| From: | Jon Frisby (jfri...@yfdirect.com) |
| Date: | 11/14/2002 10:01:20 AM |
| List: | com.mysql.lists.java |
Are you using a BLOB column? A BLOB is limited to 2^16 bytes (64KB). Try using a MEDIUMBLOB (2^24 bytes - 16MB) or a LONGBLOB (2^32 bytes - 4GB) instead.
-JF
-----Original Message----- From: Luca Lafranchi [mailto:luca...@rohag.ch] Sent: Thursday, November 14, 2002 5:32 AM To: ja...@lists.mysql.com Subject: PreparedStatement and blobs
Hi :)
I'm trying to import some jpg's into mysql 3.23.51 max-nt using the connector/J driver. Here's a sample code:
Assume my picture is in a byte[] array "pic". Autocommit is ON.
PreparedStatement pstmt = connection.prepareStatement("insert into blabla...");
ByteArrayInputStream bais = new ByteArrayInputStream(pic); pstmt.setBinaryStream(index,bais,pic.length); pstmt.executeUpdate(); pstmt.close();
This code works, but with big pictures I have problems: the bytes aren't fully written, so when I try to show the imported images, they appear corrupted. I've tried the 2.0.14 as well as the 3.0.2beta version, and this happens in both of them... I also tried using "pstmt.setBytes(index,pic)" with the same result.
The code above works perfectly with MS Access.
Has anybody a clue??
Thanks Luca
--------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/doc/ (the manual) http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <java...@lists.mysql.com> To unsubscribe, e-mail <java-unsubscribe-jfrisby=your...@lists.mysql.com>




