This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes store pdf on file to another file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "store pdf on file to another file" Watch "store pdf on file to another file" New topic
Author

store pdf on file to another file

krishna prakash
Greenhorn

Joined: Apr 02, 2009
Posts: 7
Actually my problem is I want to store the pdf file in database as a blob.and i want to retrieve the pdf file ,how can i do ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Welcome to JavaRanch.

The general approach would be to read the file into a byte[] (using the FileInputStream class), and then use that with the Blob and PreparedStatement classes for inserting it into the DB.

For retrieving it from the DB you'd call ResultSet.getBlob, and then use FileOutputStream to store it in a file.


Ping & DNS - my free Android networking tools app
 
Consider Paul's rocket mass heater.
 
subject: store pdf on file to another file
 
Similar Threads
PDF to database
How to store the PDF file in the server side?
running another application from java
Creating a file from Various chunks of different files in java
Store PDF files in the database