retrive and display PDF file

From: Jian Cheng <jcheng01_at_rochester.rr.com>
Date: Sat, 21 Jul 2001 21:51:17 GMT
Message-ID: <7%zV6.14542$3y3.3219724_at_typhoon.nyroc.rr.com>


I am trying to write a java program to retrieve a PDF file stored in a LONG RAW column in Oracle and then save the file to local file system. The problem is the file can not been displayed within Acrobat Reader. Any advices will be appreciated.

Here is part of the code:

if (myResultSet.next ())

{

// Get the PDF data as a Stream from Oracle to the client

  InputStream PdfData = myResultSet.getBinaryStream (columnName);

// Open a file to store the PDF data

  FileOutputStream file = new FileOutputStream ("Data.pdf");

// Loop, reading from the stream and writing to the file

  int c;

  while ((c = PdfData.read ()) != -1)

    file.write (c);

// Close the file

  file.close ();

Jim Received on Sat Jul 21 2001 - 23:51:17 CEST

Original text of this message