473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Reading BLOB

How to read a BLOB from oracle 8i using OleDb
Jul 21 '05 #1
1 1741
Here is my example using SqlClient... shouldn't be too different from what
you need. This example write the blob out to a file.

Public Sub Load()
Dim dr As Data.SqlClient.SqlDataReader
Dim ParamList(0) As SqlParameter
Dim index As Int32

Dim fs As FileStream
Dim bw As BinaryWriter

Dim intBufferSize As Integer = 100
Dim aryBLOB(intBufferSize - 1) As Byte
Dim lngBLOB As Long
Dim lngStartIndex As Long = 0
Dim strBinaryFile As String

If Right(m_strDocumentLocation, 1) = "\" Then
strBinaryFile = m_strDocumentLocation & m_strDocumentName
Else
strBinaryFile = m_strDocumentLocation & "\" & m_strDocumentName
End If

Try
ParamList(0) = SQLHelper.MakeInParam("@DocumentTypeID",
SqlDbType.Int, 4, 434)

dr = SQLHelper.GetDataReader(CommandType.StoredProcedur e,
"DocumentLoad", ParamList)

If dr.Read Then
fs = New FileStream(strBinaryFile, FileMode.OpenOrCreate,
FileAccess.Write)
bw = New BinaryWriter(fs)
lngStartIndex = 0
lngBLOB = dr.GetBytes(dr.GetOrdinal("document"),
lngStartIndex, aryBLOB, 0, intBufferSize)

Do While lngBLOB = intBufferSize
bw.Write(aryBLOB)
bw.Flush()
lngStartIndex += intBufferSize
lngBLOB = dr.GetBytes(dr.GetOrdinal("document"),
lngStartIndex, aryBLOB, 0, intBufferSize)
Loop

bw.Write(aryBLOB)
bw.Flush()
bw.Close()
fs.Close()
bw = Nothing
fs = Nothing
End If
Finally
If Not dr Is Nothing Then
dr.Close()
dr = Nothing
End If
SQLHelper.Dispose()
End Try
End Sub

"Ramesh" <Ra****@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com...
How to read a BLOB from oracle 8i using OleDb

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John | last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to able to load all 5000 pictures and view 50 per page using mysql_data_seek(). I would like to know what are the advantages and...
3
by: Johan Vervoort | last post by:
How can I read a binary value from a blob via ODBC (Microsoft VFP driver-win32all)? The value seems to be truncated at the first '\0' TIA
5
by: ssp | last post by:
Dear all, I'm dealing with a very tricky problem and can't seem to find the answer with google. the problem is: i want to store huge data (binaries) inside a mysql databases blob - to later...
1
by: sid_mulpuru | last post by:
I am trying to read data from a DB2 Blob Data type Field (using wsad 5.1.0) using getBlob() which when executed gives an SQL Exception 2005-01-07 15:48:40,506 ERROR - Error in...
0
by: arbidol | last post by:
i want to read and write blob data from access2000 using dao3.6, but i found it is slower than ado. As i know, reading access with dao is the best way, what happens? the mdb file i want to read...
1
by: Roberto Castro | last post by:
I have some problems with the way I am showing the BLOB fields in the Image web controls. It does work on my localhost though sometimes I need to hit Refresh for the images to load properly....
0
by: MdAZ | last post by:
We need to read and store BLOB's as storage object in MS Access databases via OLE DB. We have used several methods but no one was succesfull. If one tries the code supplied under the article...
1
by: Ken | last post by:
Hello, I'm trying to read a Blob from Oracle and then write it to an audio file(.AU). I'm using Visual Studio.Net 2003 (VB). I can't seem to get my code to work. Will someone take a look at it...
2
by: Chucker | last post by:
Hi Community, I think I can store Binary Data in SQL Server but when I try to retrieve it, I always only get one byte. I think I stored my Binary Data in SQL Server in a Colum of Type Image....
0
by: Ken | last post by:
Hello, I'm trying to read a Blob from Oracle and then write it to an audio file(.AU). I'm using Visual Studio.Net 2003 (VB). I can't seem to get my code to work. Will someone take a look at it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.