When you get a "corrupted" pdf, what do you get? A zero-byte file, or garbage?
One possibility I see, if something goes wrong with the database, your servlet may produce no output. Any exceptions that occur prior to your out.write(...) call in the "try" block will cause that out.write(...) call to never happen.
A better solution may be to create an empty buffer before the "try" block, write to that empty buffer within the "try", and then in the "finally", write that buffer to "out". The other advantage to this is that you should also be able to create & send the "Content-Length" header, which can help the Acrobat Reader plugin know how much data it should expect.
In preparing for battle I have always found that plans are useless, but planning is indispensable. -- Dwight D. Eisenhower