You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Ray Kiddy <ki...@apple.com> on 2006/11/28 19:38:53 UTC

SQL for inserting BLOB data?

If one is writing SQL to create tables and insert data and one has a  
BLOB column, how can one do this?

Looking at the reference, it seems that one cannot assign any other  
data type to BLOB. There seems to be no built-in function for, for  
example, turning a string that represents a uuencoded binary into  
binary data.

thanx - ray

------------------------------
WebObjects Engineering
Developer Tools
Apple Computer, Inc


Re: SQL for inserting BLOB data?

Posted by Andrew McIntyre <mc...@gmail.com>.
On 11/28/06, Ray Kiddy <ki...@apple.com> wrote:
>
> If one is writing SQL to create tables and insert
> data and one has a BLOB column, how can
> one do this?

There is not currently a way to do this with just SQL. However, there
is an open JIRA for similar functionality and there has been some
discussion around it. See:

http://issues.apache.org/jira/browse/DERBY-378

http://mail-archives.apache.org/mod_mbox/db-derby-dev/200610.mbox/%3c45410499.808@gmail.com%3e

Note that from the discussion, the functionality that would be
provided would be a procedure to load the contents of a BLOB from a
file.

andrew

Re: SQL for inserting BLOB data?

Posted by Daniel Noll <da...@nuix.com>.
Ray Kiddy wrote:
> Looking at the reference, it seems that one cannot assign any other data 
> type to BLOB. There seems to be no built-in function for, for example, 
> turning a string that represents a uuencoded binary into binary data.

Convert the String into byte[] using getBytes(String), and then put that 
binary data into the BLOB column.  Inserting byte[] is allowed.

Inserting Blob is possible too... but AFAIK there is not actually any 
method of creating one.  (I asked about this a while back and can't 
remember getting any responses to the question. :-/)

Daniel


-- 
Daniel Noll

Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://nuix.com/                               Fax: +61 2 9212 6902

This message is intended only for the named recipient. If you are not
the intended recipient you are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
message or attachment is strictly prohibited.