9.2 - extracting BLOB data - not handle
Posted in 1999
Topics: Stored Procedures & SPL, Java & JDBC Development
Server : 9.2
Question:
select blobcol from foo; returns the BLOB handle not the data. I've tried abunch 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?
Thanks,
Eric Weaver, Intelihealth
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!"
Eric,
What are you using for a front-end? In ESQL/C it is simply a
matter of preparing the statement and describing it. Then you modify the
locator structure for the column to specify the loc_loctype field be
either LOCMEMORY or LOCUSER. With the former the BLOB data is placed in
memory (either a block you allocate or you can let the library allocate
it), in the LOCUSER case you provide OPEN, WRITE, and CLOSE functions
which are called by the ESQL library at FETCH time and you can place the
BLOB data anywhere you want using the WRITE function which is called for
each 2K block of the BLOB. LOCUSER is the fastest way to fetch BLOBs,
LOCMEMORY the easiest. See sample code in the samples directory, the
ESQL/C manual, and in several of the utilities I have posted in utils2_ak
in the IIUG Software Repository (notably ul.ec, dbcopy.ec and myschema.ec).
There are also DBD/DBI facilities to do something similar to LOCMEMORY if
that is your front-end, see Jonathan's sample code.
Art S. Kagel
Eric Weaver wrote:
>
> 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?
>
> Thanks,
> Eric Weaver, Intelihealth