Re: Blobs in Oracle databases

Maxime LABELLE <[email protected]> Tue, 1 Apr 2003 09:19:44 +0200
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <[email protected]>
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2F81F.11F066FC
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,
=20
I'm using the OraOLEDB.Oracle provider.
=20
Alternatively, I have tried the other way around, that it,
implementing ISequentialStream myself and handing out
and interface pointer to the Rowset, then calling =
IRowsetChange::SetData
=20
This leads to a E_POINTER error.
=20
Cheers.
Maxime.

-----Message d'origine-----
De : OLEDB_DEV [mailto:[email protected]]De la part de Alan
Gamboa
Envoy=E9 : lundi 31 mars 2003 19:55
=C0 : [email protected]
Objet : Re: [OLEDB_DEV] Blobs in Oracle databases


Quick question, which driver are you using MS or Oracle, I have had =
better
luck with the Oracle driver...

-----Original Message-----
From: Maxime LABELLE [mailto:[email protected]]
Sent: Monday, March 31, 2003 10:41 AM
To: [email protected]
Subject: [OLEDB_DEV] Blobs in Oracle databases



Hi all,=20

Has anyone successfully stored blobs in an Oracle table=20
using ISequentialStream. Here is how I have tried it:=20

1. First I insert a new record in the table, with all meaningful=20
    information set, and the blob contents initialized to EMPTY_BLOB(): =

    INSERT INTO MYTABLE (ID, CONTENTS) VALUES (:id, EMPTY_BLOB())=20

2. Then, I select the blob column using an SQL statement.=20
    Before calling IRowset::GetData, I perform the binding=20
    with the appropriate information:=20

    a) wType =3D DBTYPE_UNKNOWN=20
    b) dwPart =3D DBPART_VALUE | DBPART_STATUS=20
    b) pObject->iid =3D __uuidof(ISequentialStream)=20
    c) pObject->dwFlags =3D STGM_WRITE=20

    SELECT CONTENTS FROM MYTABLE WHERE ID =3D :id=20

The GetData call succeeds and I have a valid ISequentialStream=20
pointer. But actually writing the data returns E_FAIL with no=20
precision to what failed whatsoever.=20

I have tried initializing the column to NULL and using dwFlags =3D =
STGM_CREATE

but that doesn't work either.=20

Has anyone some useful tips to share?=20
Cheers.=20
Maxime.=20


You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.

You can read messages from the OLEDB_DEV archive, unsubscribe from
OLEDB_DEV, or subscribe to other DevelopMentor lists at
http://discuss.develop.com.=20


You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

------_=_NextPart_001_01C2F81F.11F066FC
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<TITLE>Blobs in Oracle databases</TITLE>

<META content=3D"MSHTML 5.00.3315.2870" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003>Hi,</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D120191707-01042003>I'm=20
using the OraOLEDB.Oracle provider.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003>Alternatively, I have tried the other way =
around, that=20
it,</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003>implementing ISequentialStream myself and =
handing=20
out</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D120191707-01042003>and=20
interface pointer to the Rowset, then calling=20
IRowsetChange::SetData</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D120191707-01042003>This=20
leads to a E_POINTER error.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003>Cheers.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D120191707-01042003>Maxime.</SPAN></FONT></DIV>
<BLOCKQUOTE>
  <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
  size=3D2>-----Message d'origine-----<BR><B>De&nbsp;:</B> OLEDB_DEV=20
  [mailto:[email protected]]<B>De la part de</B> Alan=20
  Gamboa<BR><B>Envoy=E9&nbsp;:</B> lundi 31 mars 2003 =
19:55<BR><B>=C0&nbsp;:</B>=20
  [email protected]<BR><B>Objet&nbsp;:</B> Re: [OLEDB_DEV] =
Blobs in=20
  Oracle databases<BR><BR></DIV></FONT>
  <DIV><SPAN class=3D359290118-31032003><FONT color=3D#0000ff =
face=3DArial=20
  size=3D2>Quick question, which driver are you using MS or Oracle, I =
have had=20
  better luck with the Oracle driver...</FONT></SPAN></DIV>
  <BLOCKQUOTE>
    <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
    size=3D2>-----Original Message-----<BR><B>From:</B> Maxime LABELLE=20
    [mailto:[email protected]]<BR><B>Sent:</B> Monday, March 31, 2003 =
10:41=20
    AM<BR><B>To:</B> [email protected]<BR><B>Subject:</B>=20
    [OLEDB_DEV] Blobs in Oracle databases<BR><BR></FONT></DIV>
    <P><FONT face=3DArial size=3D2>Hi all,</FONT> </P>
    <P><FONT face=3DArial size=3D2>Has anyone successfully stored blobs =
in an Oracle=20
    table</FONT> <BR><FONT face=3DArial size=3D2>using =
ISequentialStream. Here is=20
    how I have tried it:</FONT> </P>
    <P><FONT face=3DArial size=3D2>1. First I insert a new record in =
the table, with=20
    all meaningful</FONT> <BR><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;=20
    information set, and the blob contents initialized to =
EMPTY_BLOB():</FONT>=20
    <BR><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; INSERT INTO =
MYTABLE (ID,=20
    CONTENTS) VALUES (:id, EMPTY_BLOB())</FONT> </P>
    <P><FONT face=3DArial size=3D2>2. Then, I select the blob column =
using an SQL=20
    statement.</FONT> <BR><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp; Before=20
    calling IRowset::GetData, I perform the binding</FONT> <BR><FONT =
face=3DArial=20
    size=3D2>&nbsp;&nbsp;&nbsp; with the appropriate =
information:</FONT> </P>
    <P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; a) wType =3D=20
    DBTYPE_UNKNOWN</FONT> <BR><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp; b)=20
    dwPart =3D DBPART_VALUE | DBPART_STATUS</FONT> <BR><FONT =
face=3DArial=20
    size=3D2>&nbsp;&nbsp;&nbsp; b) pObject-&gt;iid =3D =
__uuidof(ISequentialStream)=20
    </FONT><BR><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; c) =
pObject-&gt;dwFlags=20
    =3D STGM_WRITE</FONT> </P>
    <P><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; SELECT CONTENTS =
FROM MYTABLE=20
    WHERE ID =3D :id</FONT> </P>
    <P><FONT face=3DArial size=3D2>The GetData call succeeds and I have =
a valid=20
    ISequentialStream</FONT> <BR><FONT face=3DArial size=3D2>pointer. =
But actually=20
    writing the data returns E_FAIL with no</FONT> <BR><FONT =
face=3DArial=20
    size=3D2>precision to what failed whatsoever.</FONT> </P>
    <P><FONT face=3DArial size=3D2>I have tried initializing the column =
to NULL and=20
    using dwFlags =3D STGM_CREATE</FONT> <BR><FONT face=3DArial =
size=3D2>but that=20
    doesn't work either.</FONT> </P>
    <P><FONT face=3DArial size=3D2>Has anyone some useful tips to =
share?</FONT>=20
    <BR><FONT face=3DArial size=3D2>Cheers.</FONT> <BR><FONT =
face=3DArial=20
    size=3D2>Maxime.</FONT> </P><BR>You can read messages from the =
OLEDB_DEV=20
    archive, unsubscribe from OLEDB_DEV, or subscribe to other =
DevelopMentor=20
    lists at http://discuss.develop.com.</BLOCKQUOTE>You can read =
messages from=20
  the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe to =
other=20
  DevelopMentor lists at http://discuss.develop.com. =
</BLOCKQUOTE></BODY></HTML>
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

------_=_NextPart_001_01C2F81F.11F066FC--