Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with response binarywrite

Status
Not open for further replies.

bookouri

IS-IT--Management
Feb 23, 2000
1,464
US
I have a bunch of .asp pages that select image_date from an oracle table. The image_data was a long raw data type. The oracle tables were just update and the image_data is now a BLOB data type. Since the change my .asp pages wont display the image. What changes do i have to make to display my BLOB images?

Set rs = con.Execute("SELECT image_data FROM images where images.active_flag = 'Y' and image_id=" & target)
Response.BinaryWrite rs("image_data")
 
Grasping at straws here... how about setting the content type to [tt]image/jpeg[/tt]

Also you might try adding a Content-Disposition header and then requesting the ASP by typing its URL directly into the browser and see what happens if you choose "Save" in the browser.

[tt]Response.AddHeader "Content-Disposition", "attachment;filename=MyPic.jpg"[/tt]
 
Yep, i tried every variation of the type. image/* or image/jpg...i tried a couple of things with the header but I'll give it another shot.
 
I think the forum pronounces enough. It just wants to see a _coherent_ and _complete_ script (not fragments here or there) on that part of the functionality.
 
ok, finally solved the problem...i tried so many things I cant remember all of them, but the main thing that made a difference and seemed to solve all problems was simply changing the connection "provider" On the original pages the connect provider was set to MSDAORA.DATA. Since I was having problems retrieving data from an oracle source I switched the connect provider to ORAOLEDB.ORACLE and the images magically began to work.

I appreciate all the responses and help.

thanks
 
Thanks for posting your solution bookouri. What exactly was the problem with the database driver? Or rather, what is different about the two drivers? This brings me back to thinking the problem has something to do with the size of the blob.

I wonder if the old driver would work if you didn't try to get it all in a single chunk. Maybe in 4k chunks like this:
[tt]
size = rs.fields("image_data").actualSize
chunks = size mod 4096
if (chunks * 4096) < size then
chunks = chunks + 1
end if
for i = 1 to chunks
Response.BinaryWrite rs("image_data").getchunk(4096)
next
[/tt]
 
I did try using the getchunk method, but didnt try breaking it up into multiple chunks. Anyway, the basic problem is that the Microsoft Driver would allow me to display oracle Long_Raw data columns holding jpg files using response.binarywrite, but when the oracle tables were updated to blob data columns, the response.binarywrite stopped working. Changing the driver to the Oracle provided drivers fixed the problem.



If i get a chance Ill try to test out the old driver with the getchunk, it would be interesting to know if it would work that way..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top