Loading jpg file into byte type column
Posted in 1999
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I'm using Informix 7.23.UC1 and would like to create a table with a column of type byte in order to store images. The images are originally stored in jpg files. Does the engine have a native capability of loading the file, i.e., through a SQL extension? Or will I have to write a custom ESQL/C routine to do this? Or is this type of capability only present with Informix 9.xx?
Thomas G. Smith wrote: > I'm using Informix 7.23.UC1 and would like to create a table with > a column of type byte in order to store images. The images are > originally stored in jpg files. Does the engine have a native > capability of loading the file, i.e., through a SQL extension? No; some program will have to feed the file to the database. This will be written in ESQL/C or some equivalent system. The standard LOAD format for binary data is not suitable for your task, so the norm > Or will I have to write a custom ESQL/C routine to do this? You could write a custom routine to do this. Or you could adapt the UPDBLOB code which comes with SQLCMD in the IIUG software archives (http://www.iiug.org). That code is mainly an exercise in (a) blob handling and (b) command line argument handling. SQLCMD itself is not usable; it only handles the standard LOAD format data. If you need details on the standard LOAD format, that is available in a file which also (surprise, surprise) comes with SQLCMD. > Or is this type of capability only present with Informix 9.xx? Oh, you can do it with any version of OnLine; you don't need 9.xx. Although, come to think of it, the 9.xx smart blob routines probably can handle it directly where the earlier versions with their simple blobs cannot. On the other hand, the BLOB type is different from the BYTE type. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN #include <disclaimer.h>