Re: Blobs in Oracle databases

Alan Gamboa <[email protected]> Mon, 31 Mar 2003 12:54:37 -0500
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_01C2F7AE.98CB5DB0
Content-Type: text/plain;
        charset="iso-8859-1"

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,

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

1. First I insert a new record in the table, with all meaningful
    information set, and the blob contents initialized to EMPTY_BLOB():
    INSERT INTO MYTABLE (ID, CONTENTS) VALUES (:id, EMPTY_BLOB())

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

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

    SELECT CONTENTS FROM MYTABLE WHERE ID = :id

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

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

but that doesn't work either.

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


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.

------_=_NextPart_001_01C2F7AE.98CB5DB0
Content-Type: text/html;
        charset="iso-8859-1"

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

<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=359290118-31032003><FONT face=Arial color=#0000ff size=2>Quick
question, which driver are you using MS or Oracle, I have had better luck with
the Oracle driver...</FONT></SPAN></DIV>
<BLOCKQUOTE>
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
  size=2>-----Original Message-----<BR><B>From:</B> Maxime LABELLE
  [mailto:[email protected]]<BR><B>Sent:</B> Monday, March 31, 2003 10:41
  AM<BR><B>To:</B> [email protected]<BR><B>Subject:</B> [OLEDB_DEV]
  Blobs in Oracle databases<BR><BR></FONT></DIV>
  <P><FONT face=Arial size=2>Hi all,</FONT> </P>
  <P><FONT face=Arial size=2>Has anyone successfully stored blobs in an Oracle
  table</FONT> <BR><FONT face=Arial size=2>using ISequentialStream. Here is how
  I have tried it:</FONT> </P>
  <P><FONT face=Arial size=2>1. First I insert a new record in the table, with
  all meaningful</FONT> <BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp;
  information set, and the blob contents initialized to EMPTY_BLOB():</FONT>
  <BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; INSERT INTO MYTABLE (ID,
  CONTENTS) VALUES (:id, EMPTY_BLOB())</FONT> </P>
  <P><FONT face=Arial size=2>2. Then, I select the blob column using an SQL
  statement.</FONT> <BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; Before
  calling IRowset::GetData, I perform the binding</FONT> <BR><FONT face=Arial
  size=2>&nbsp;&nbsp;&nbsp; with the appropriate information:</FONT> </P>
  <P><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; a) wType = DBTYPE_UNKNOWN</FONT>
  <BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; b) dwPart = DBPART_VALUE |
  DBPART_STATUS</FONT> <BR><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; b)
  pObject-&gt;iid = __uuidof(ISequentialStream) </FONT><BR><FONT face=Arial
  size=2>&nbsp;&nbsp;&nbsp; c) pObject-&gt;dwFlags = STGM_WRITE</FONT> </P>
  <P><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; SELECT CONTENTS FROM MYTABLE
  WHERE ID = :id</FONT> </P>
  <P><FONT face=Arial size=2>The GetData call succeeds and I have a valid
  ISequentialStream</FONT> <BR><FONT face=Arial size=2>pointer. But actually
  writing the data returns E_FAIL with no</FONT> <BR><FONT face=Arial
  size=2>precision to what failed whatsoever.</FONT> </P>
  <P><FONT face=Arial size=2>I have tried initializing the column to NULL and
  using dwFlags = STGM_CREATE</FONT> <BR><FONT face=Arial size=2>but that
  doesn't work either.</FONT> </P>
  <P><FONT face=Arial size=2>Has anyone some useful tips to share?</FONT>
  <BR><FONT face=Arial size=2>Cheers.</FONT> <BR><FONT face=Arial
  size=2>Maxime.</FONT> </P><BR>You can read messages from the OLEDB_DEV
  archive, unsubscribe from OLEDB_DEV, or subscribe to other 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_01C2F7AE.98CB5DB0--