Re: How to deal with LOBs in C++
Date: Fri, 30 Oct 1998 10:08:09 +0100
Message-ID: <363981F9.11A4_at_fuzzy-online.de>
rbanerji_at_icfkaiser.com wrote:
>
> I need to open a BFILE, read its contents into a BLOB and then access this
> blob in C++ code.
>
> How can this be done? Will I have to use Pro C? Is there any other way?
>
> What is the API, DBMS_LOB packake, and OCI? What are some good references for
> these features? Will any one of them be useful in what I need to do?
>
> I am not an Oracle programmer. Until now I have simply been sending in SQLs
> to the Oracle DBMS.
>
> Thanks,
>
If you want to access LOBs from C++ you need to write either a Pro C or
OCI - Programm.
With Pro C one writes a *.pc - file with C/C++ - Code and embedded
SQL-Statements.
The Pro C - Precompiler takes this *.pc file and generates a valid *.cpp
file that contains
data structures and calls to the sqllib. The advantage of Pro C is that
establishing
a connection and getting started is pretty uncomplicated.
The Oracle Call Interface is a library that allows interaction with the
Oracle DBMS.
Preparing SQL-Statments and Binding In- and Output-Variables is more
work than with Pro C.
In OCI there are functions like OCILobRead(), OCILobWrite() and
OCILobGetLength().
You don't necessarily need the DBMS_LOB Package.
The advantage of OCI is that there is no extra precompile step.
This makes IMHO debugging and development easier.
There are a few example files in the ORACLE OCI-Dokumentation and on the Oracle Technology network http://technet.oracle.com/.
With C++, as opposed with C, you might have to change the typedef text
to OraText in
the OCI header files. text is used by the IOstreams of the standard
library.
You might also want to take a look at:
http://home.sprynet.com/sprynet/skuchin/otl_1pg.htm .
This is a class that is a wrapper around OCI-calls. I don't know wether
it supports LOBs.
-- /** * \author Bernhard.Schmalhofer_at_fuzzy-online.de */Received on Fri Oct 30 1998 - 10:08:09 CET