Re: Unable to read BLOB objects through ADO.NET

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

neerajb_at_noida.nospamhcltech.com
Date: 02/09/05


Date: Wed, 9 Feb 2005 10:09:05 -0800

I am using following code for retreival of Blob Data.
Using this code I am getting the DOCfile saves on the Disc.
It's size also matches with the original document.

But when i open that file it gives me the following message:

"Microsoft Word can't import the specified format.An Error occured andthis
feature no more functioning properly.Please Contact your System
Administrator."

It seems that code is working properly and retreiving the BLOB object also
from the Oracle but either there is problem with Filestream Object in writing
the byte array to file or may be somethign else..

Please help...

OracleLob blob = oraImgReader.GetOracleLob(1);

// Create a byte array of the size of the Blob obtained
Byte[] b = new Byte[blob.Length];

// Read blob data into byte array
int i = blob.Read(b,0,System.Convert.ToInt32(blob.Length));

System.IO.FileStream fs =new System.IO.FileStream("C:\\test25.doc",
System.IO.FileMode.Create, System.IO.FileAccess.Write);
fs.Write(b, 0, b.Length);
fs.Close();

"Paul Clement" wrote:

> On Tue, 8 Feb 2005 21:41:02 -0800, "neerajb@noida.nospamhcltech.com"
> <neerajbnoidanospamhcltechcom@discussions.microsoft.com> wrote:
>
> ¤
> ¤
> ¤ "Paul Clement" wrote:
> ¤
> ¤ > On Sun, 6 Feb 2005 21:21:02 -0800, "neerajb@noida.nospamhcltech.com"
> ¤ > <neerajbnoidanospamhcltechcom@discussions.microsoft.com> wrote:
> ¤ >
> ¤ > ¤ Hi,
> ¤ > ¤
> ¤ > ¤ I need the help deperately.
> ¤ > ¤
> ¤ > ¤ My requirement is that i have to retrieve BLOB object from the Oracle and
> ¤ > ¤ need to save it on the Hard Disk through ADO.NET.
> ¤ > ¤
> ¤ > ¤ For this purpose i have tried it with OLEDB.NET Data provider and also
> ¤ > ¤ through the oracle client.
> ¤ > ¤
> ¤ > ¤ As i know that BLOB object contains Microsoft Word Document i am saving it
> ¤ > ¤ through Filestream object.
> ¤ > ¤
> ¤ >
> ¤ > See if the following helps:
> ¤ >
> ¤ > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadonet/html/advoracledataaccess.asp
> ¤ >
> ¤ >
> ¤ > Paul ~~~ pclement@ameritech.net
> ¤ > Microsoft MVP (Visual Basic)
> ¤ >
> ¤
> ¤
> ¤
> ¤ Hi Paul,
> ¤
> ¤ Thanks for the reply.
> ¤
> ¤ In the MSDN article it mentions the way to retreive the BLOB object which
> ¤ you can see in my code also.
> ¤
> ¤ Problem is that the Doc file which i am saving through FileStream is not
> ¤ opening in the Word 2000 properly and it gives the message that word is
> ¤ unable to read the specified format and it shows some junk characters in the
> ¤ file although it's no. of pages as well as size matches the original document.
> ¤
>
> How was the document saved to the database? Have you been able to use another other method to
> retrieve it (such as ADO)?
>
>
> Paul ~~~ pclement@ameritech.net
> Microsoft MVP (Visual Basic)
>



Relevant Pages

  • Re: Goof in the design of setBinaryStream
    ... > create a Blob object in order to feed to an update or insert. ... java.sql.Blob and java.sql.Clob that is not tied to an active connection. ... JDBC drivers will accept a Blob object unless it was their native version. ... FirstSQL/J Object/Relational DBMS ...
    (comp.lang.java.databases)
  • Re: Create java.sql.Blob from byte[]
    ... > How can I create Blob from byte array? ... Get the Blob as an Oracle BLOB object. ... Set the Blob column in the prepared statement using the BLOB ... Execute the update statement and commit the result. ...
    (comp.lang.java.databases)
  • Re: Create java.sql.Blob from byte[]
    ... > Use JDBC or your SQL tool to insert a new record with a Blob. ... > Get the Blob as an Oracle BLOB object. ... > Set the Blob column in the prepared statement using the BLOB ... > Execute the update statement and commit the result. ...
    (comp.lang.java.databases)
  • Re: Storing BLOBs outside database
    ... The biggest problem with storing BLOB in the file system is to guarantee the consistency of the data. ... SQL Server 2008 will have the new FILESTREAM data type which provides storing BLOB data to the file system while maintaining transactional consistency. ...
    (comp.databases.ms-sqlserver)
  • AW: BAD BLOB PAGE
    ... alternatively youwould need to unload around the corruption, ... The error is that a blob data cannot be found. ...
    (comp.databases.informix)