BLOBs for dummies?
Posted in 1999
Topics: Storage & Space Management
Hi, my name is Ali. I'm a computer science major in my senior year of
college and I'm working on an independent research project involving
informix databases & datablades on a UNIX platform, but I'm a real newcomer
to them and I feel lost. I've read through the postings about BLOBs, but
haven't understood them enough to apply them to the (I think) simple things
I'm trying to do, so if there is anyone out there that can make it even more
simple for me, I would appreciate it.
I'm having difficulty understanding what to do with BLOBs. I have a table
created with a BLOB type and I want to get things that are BLOBs (pictures)
into that table. What I am trying to understand is how to get the pictures
from my home folder into the database and into the table. I am assuming
that I am supposed to load these somehow with dbload or some other type of
command, but I cannot figure out how the syntax goes. Also, I am confused
about the spaces to load things into in the database - do BLOBs go into the
dbspace? One final question is, does the entire BLOB (in my case a picture)
get loaded actually permanently into the database?
I would really appreciate it if anyone would take a moment to help me. In
the meantime, I'll be practicing my burger-flipping technique so I'll have
something to fall back on when I flunk my senior year :)
Thank you so much for taking the time!
Ali
To load BLOBs with dbload you would have to encode the image as escaped
octal codes as a field in a delimited or fixed length text file. This is
not practical. Dbload's BLOB load capability is most useful for reloading
the results of a dbaccess or 4GL UNLOAD which exports any BLOB columns in
this way.
If you have the SDK (which is free), or 4GL, there are examples of loading
a BLOB column from a file using those tools in the Samples directory. Also
the Informix manuals (ESQL/C Programmers Guide & 4GL By Example) contain
some examples and details.
You can also check out the source for Jonathan Leffler's sqlcmd utility on
the IIUG Software Repository for more examples.
Art S. Kagel
Ali wrote:
>
> Hi, my name is Ali. I'm a computer science major in my senior year of
> college and I'm working on an independent research project involving
> informix databases & datablades on a UNIX platform, but I'm a real newcomer
> to them and I feel lost. I've read through the postings about BLOBs, but
> haven't understood them enough to apply them to the (I think) simple things
> I'm trying to do, so if there is anyone out there that can make it even more
> simple for me, I would appreciate it.
>
> I'm having difficulty understanding what to do with BLOBs. I have a table
> created with a BLOB type and I want to get things that are BLOBs (pictures)
> into that table. What I am trying to understand is how to get the pictures
> from my home folder into the database and into the table. I am assuming
> that I am supposed to load these somehow with dbload or some other type of
> command, but I cannot figure out how the syntax goes. Also, I am confused
> about the spaces to load things into in the database - do BLOBs go into the
> dbspace? One final question is, does the entire BLOB (in my case a picture)
> get loaded actually permanently into the database?
>
> I would really appreciate it if anyone would take a moment to help me. In
> the meantime, I'll be practicing my burger-flipping technique so I'll have
> something to fall back on when I flunk my senior year :)
>
> Thank you so much for taking the time!
> Ali