Re: 9.2 - extracting BLOB data - not handle
Posted in 1999
Topics: Stored Procedures & SPL, Data Types & Schema Design, Java & JDBC Development
1) Using blobtoFile does not get you the data as a result of the SQL. It returns a
file name. I know I can export the Blob to the file system using blobtoFile but
thats not what I want to do. I want the column results of my SQL statement to
contain the binary data - not a file name and not the LO handle.
2) Casting the content to lvarchar won't work either since most of our Blob content
is larger than 2K. Creating a UDT based on blob has possibilities I guess but I
can't believe that there is not an easier way to accomplish this. Creating support
functions etc. in order to retrieve existing data from a table seems ridiculous.
Eric
--
Henrik Loeser wrote:
> Hi,
>
> In article <7sokjl$e4m$1@mouth.intelihealth.com>, you write:
> > Server : 9.2
> >
> > Question:
> >
> > select blobcol from foo; returns the BLOB handle not the data. I've tried a
> > bunch of different things (SPL, Java UDRs, Casting) and everything seems to
> > return the LO handle rather the the binary data.> >
> > Does anyone know how to extract the actual data (not the LO handle) from a
> > smart blob column using SQL?
>
> there are two solutions:
>
> 1) You use the blobToFile function, writing the blob data to a file.
> 2) You have your own (blob-based) type and provide support functions
> to cast the content to a lvarchar.
>
> >
> > Thanks,
> > Eric Weaver, Intelihealth
> >
> >
>
> Henrik Loeser
>
> --
> ----------------------------------------------------------------------
> Henrik Loeser email: loeser@informatik.uni-kl.de
> Dept. of Computer Science loeser@gmx.de
> University of Kaiserslautern http://www.uni-kl.de/AG-Haerder/Loeser/
> P.O. Box 3049 Building: 36 Room: 320
> D-67653 Kaiserslautern Phone: (+49) 631 205 3283
> Germany Fax : (+49) 631 205 3299
> ----------------------------------------------------------------------
> "asd dsjiusa sdasd uhiuh hhhajief okas aksjda lkja ytf!"
In article <37F09FFB.F2EE642C@ih1.com>, Eric Weaver <epost@ih1.com> writes: > 1) Using blobtoFile does not get you the data as a result of the SQL. It returns a > file name. I know I can export the Blob to the file system using blobtoFile but > thats not what I want to do. I want the column results of my SQL statement to > contain the binary data - not a file name and not the LO handle. > > 2) Casting the content to lvarchar won't work either since most of our Blob content > is larger than 2K. Creating a UDT based on blob has possibilities I guess but I > can't believe that there is not an easier way to accomplish this. Creating support > functions etc. in order to retrieve existing data from a table seems ridiculous. AFAIK, the 2k limit is for using a lvarchar as an attribute (column). However, there's no limit when using a variable-length (blob-based) opaque type. There is an article in the Informix IDN DataBlade corner concerning memory size limits. I don't know the column's data type, but what about creating a user-defined cast? Thus, you can cast your existing column data to lvarchar and display your blobs. However, you have to use C functions and some restrictions exist. May be, Java should work as well. Henrik -- ---------------------------------------------------------------------- Henrik Loeser email: loeser@informatik.uni-kl.de Dept. of Computer Science loeser@gmx.de University of Kaiserslautern http://www.uni-kl.de/AG-Haerder/Loeser/ P.O. Box 3049 Building: 36 Room: 320 D-67653 Kaiserslautern Phone: (+49) 631 205 3283 Germany Fax : (+49) 631 205 3299 ---------------------------------------------------------------------- "asd dsjiusa sdasd uhiuh hhhajief okas aksjda lkja ytf!"