Corrupted PDFs when converting from BLOB?

I just spent the last couple of hours trying to figure out why some of the PDFs on a page are coming back as corrupted, while the rest work fine. Turns out it was that BLOB setting in the datasource! I didn't create this datasource, but when I checked it, sure enough BLOBs were not enabled for this datasource. Once I turned that setting on, my PDFs started working fine. However, I don't know why some of them would work, even though that setting was off...

And before you yell at me for using BLOBs...I am not the one that originally wrote this app, and pulling all of these PDFs out of the DB so I could store them on the file system is not a project I want to undertake right now, so I'm just living with the BLOBs for the time being.

So if you are fighting with corrupted PDFs, check your data source setting. :)

Comments
I will have to test this out. We had an issue with this about 3 months ago where we were trying to extract the pdf data. Half of the blobs were corrupted and the other half was not. We noticed that part of the data was truncated and the eof was missing.
# Posted By Andrew Leaf | 9/9/08 12:26 PM
Totally feel your pain man. I had the same problem a long while back. I thought I was going crazy until I remembered the data source settings. Because the code I wrote that worked with BLOBs was used on multiple servers (which didn't all have their data source settings in sync) I altered my save routine to read the record I just saved back to ensure that the entire BLOB was in fact saved to the DB correctly, and if it wasn't I threw an error stating to enable the "Enable BLOB" setting on the data source.
# Posted By Kurt Bonnet | 9/9/08 10:17 PM
We had the exact same thing happen at my last job ... migrating to Oracle 10g from 9i and really tightening up security. As a result, we had new datasources to add, and the default settings for enableCLOB and enableBLOB were false. So each PDF was being truncated at a certain length, can't remember offhand what it was, but that would probably be why some of yours were surviving. Anything below a certain size was fine, because CF would just return the first X bytes.

We spent all this time figuring out what it was returning, trying to ensure we had stored the PDFs properly and all that, and then we saw the datasource settings ...
# Posted By Dave DuPlantis | 9/10/08 5:35 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.9. Contact Blog Owner