By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,144 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,144 IT Pros & Developers. It's quick & easy.

Retrieving Oracle BLOB

P: n/a
Hello,

I have Word documents stored in the Oracle database in the BLOB field
that I need to retrieve. I've found the way of doing it:

While dr.Read
sName = dr("TE_PM_ATTACH_NAME")
bLob = dr.GetOracleLob(1)
Response.AppendHeader("Content-type:",
"application/force-download")
Response.AppendHeader("Content-Disposition", "attachment;
filename=" & sName)
Response.AppendHeader("Content-Length", bLob.Length)
Response.Charset = "UTF-8"
' write the blob data - this will begin to force the
download
Response.BinaryWrite(bLob.Value)

End While

The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:

This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)

So he can only download this document.

If it's an image file instead of word document - there are no problems.

I would appreciate any suggestions on how to deal with this.

Thank you,

Peter

Jul 25 '06 #1
Share this Question
Share on Google+
11 Replies


P: n/a
The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:

This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)
I think the problem lies here:
Response.AppendHeader("Content-type:", "application/force-download")

For word this should be:

"application/vnd.ms-word"

A bit more information can be found here:
http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html

Jul 25 '06 #2

P: n/a
Thank you very much, Mischa, I'll try this.

Peter

"Mischa Kroon" <ww*@bloggingabout.netwrote in message
news:55**************************@news.chello.nl.. .
>The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:

This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)

I think the problem lies here:
Response.AppendHeader("Content-type:", "application/force-download")

For word this should be:

"application/vnd.ms-word"

A bit more information can be found here:
http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html

Jul 26 '06 #3

P: n/a
Didn't work, unfortunately. It seems to be a problem with the local
caching, but I don't know what exactly.

Mischa Kroon wrote:
The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:

This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)

I think the problem lies here:
Response.AppendHeader("Content-type:", "application/force-download")

For word this should be:

"application/vnd.ms-word"

A bit more information can be found here:
http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html
Jul 26 '06 #4

P: n/a
I'm thinking maybe I should add custom headers in IIS. Not sure what is
required...

Mischa Kroon wrote:
The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:

This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)

I think the problem lies here:
Response.AppendHeader("Content-type:", "application/force-download")

For word this should be:

"application/vnd.ms-word"

A bit more information can be found here:
http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html
Jul 26 '06 #5

P: n/a

"Peter Afonin" <pv*@speakeasy.netwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Didn't work, unfortunately. It seems to be a problem with the local
caching, but I don't know what exactly.
Are you giving the downloads distinct filenames ?
If not you might want to try this.
Jul 26 '06 #6

P: n/a
Is this an SSL connection? If so, and you are using IE, if the "Save
Encrypted files to disk" is disabled then IE will not be able to put a copy
of the file in "Temporary Internet Files".
--
Brad

"Software is like melted pudding..."
"Peter Afonin" wrote:
I'm thinking maybe I should add custom headers in IIS. Not sure what is
required...

Mischa Kroon wrote:
The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:
>
This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)
I think the problem lies here:
Response.AppendHeader("Content-type:", "application/force-download")

For word this should be:

"application/vnd.ms-word"

A bit more information can be found here:
http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html

Jul 26 '06 #7

P: n/a
Hi Mischa,

How would I do this? No, I don't. I store the name of the original file
in a separate field, and then just call the row id to retrieve this
file from the BLOB field.

Peter

Mischa Kroon wrote:
"Peter Afonin" <pv*@speakeasy.netwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Didn't work, unfortunately. It seems to be a problem with the local
caching, but I don't know what exactly.

Are you giving the downloads distinct filenames ?
If not you might want to try this.
Jul 26 '06 #8

P: n/a
Thank you, Brad.

No, this is just our Intranet, no SSL.

Peter

Brad Roberts wrote:
Is this an SSL connection? If so, and you are using IE, if the "Save
Encrypted files to disk" is disabled then IE will not be able to put a copy
of the file in "Temporary Internet Files".
--
Brad

"Software is like melted pudding..."
"Peter Afonin" wrote:
I'm thinking maybe I should add custom headers in IIS. Not sure what is
required...

Mischa Kroon wrote:
The only problem here is that when the customer is trying to open the
document, in most cases (but not always, which is weird) he gets
message like this:

This file could not be found.
Try one or more of the following:
* Check the spelling of the name of the document.
* Try a different file name.
(C:\...\Accessing BLOB data 2[1].doc)
>
I think the problem lies here:
Response.AppendHeader("Content-type:", "application/force-download")
>
For word this should be:
>
"application/vnd.ms-word"
>
A bit more information can be found here:
http://ppewww.ph.gla.ac.uk/~flavell/...tent-type.html
Jul 26 '06 #9

P: n/a

"Peter Afonin" <pv*@speakeasy.netwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi Mischa,

How would I do this? No, I don't. I store the name of the original file
in a separate field, and then just call the row id to retrieve this
file from the BLOB field.

You might want to start doing this, otherwise you could use a guid or the id
of the database table:

xxx0123.doc or something.
Jul 26 '06 #10

P: n/a
Thank you, I'll try.

Peter

Mischa Kroon wrote:
"Peter Afonin" <pv*@speakeasy.netwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi Mischa,

How would I do this? No, I don't. I store the name of the original file
in a separate field, and then just call the row id to retrieve this
file from the BLOB field.


You might want to start doing this, otherwise you could use a guid or the id
of the database table:

xxx0123.doc or something.
Jul 27 '06 #11

P: n/a
This didn't work for me, but I've found the problem!

I was missing this line at the end:

Response.End()

As soon as I added it - everything started to work as expected.

Thank you for all you suggestions.

Peter

Mischa Kroon wrote:
"Peter Afonin" <pv*@speakeasy.netwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
Hi Mischa,

How would I do this? No, I don't. I store the name of the original file
in a separate field, and then just call the row id to retrieve this
file from the BLOB field.


You might want to start doing this, otherwise you could use a guid or the id
of the database table:

xxx0123.doc or something.
Jul 27 '06 #12

This discussion thread is closed

Replies have been disabled for this discussion.