• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Appending to a Blob

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey gang -

I have a large Blob object, and I would like to append to it rather than rewrite it. The following code works for Oracle (10.2) but not with MySQL (5.5). It works on a sample table called TEST_BLOB with a long primary key (UNIQUEID) and a blob (DETAILS):

Thoughts?

Thanks in advance,
Dallas
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

First of all, how does the code fail in MySQL? Just saying "it does not work" is not very useful.

I don't use MySQL myself, but what I've found by googling mysql append to blob seems to suggest you need to use the CONCAT function in MySQL to add to a BLOB.

Also, this page says:

The BLOB implementation does not allow in-place modification (they are copies, as reported by the DatabaseMetaData.locatorsUpdateCopies() method). Because of this, use the corresponding PreparedStatement.setBlob() or ResultSet.updateBlob() (in the case of updatable result sets) methods to save changes back to the database.


I'm afraid that might mean that appending to an existing blob is not supported by Connector/J.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dallas Wrege wrote:Hey gang -
I have a large Blob object, and I would like to append to it rather than rewrite it.
...



I had a similiar problem, and at least for Derby it works if I add

Greetings
Bernd
 
reply
    Bookmark Topic Watch Topic
  • New Topic