aspose file tools
The moose likes JDBC and the fly likes How to store and retrieve word file from sybase Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "How to store and retrieve word file from sybase" Watch "How to store and retrieve word file from sybase" New topic
Author

How to store and retrieve word file from sybase

Shiva Battula
Greenhorn

Joined: Jun 06, 2005
Posts: 20
Hi,
Can anyone help/provide me some examples/URLS to store and retrieve word file from sybase database in Jsps/Servlets?
Thanks,
Sivasankar


SCJP and SCWCD.
Rusty Smythe
Ranch Hand

Joined: Aug 09, 2006
Posts: 93
This will help: Show some effort

Here's is the general approach I would take:

Storing
1) Upload word file from user to server
2) Read file as a stream, write that stream to the database (probably to a BLOB column)
3) Delete file on server

You could probably just read the upload stream and write to the database in one step; then you wouldn't have to clean up anything or worry about local disk space.

Retrieving
A) Stream data from db to HttpServletResponse, setting the mime type to the one appropriate for MS Word.
[ August 22, 2006: Message edited by: Rusty Smythe ]
Shiva Battula
Greenhorn

Joined: Jun 06, 2005
Posts: 20
Hi Rusty,
Thank you. Its very first time for me to work with BLOBs and Sybase.
Iam able to get byte array from uploaded file in servlet.
I was stuck while storing byte array ( from word document ) to DB.I need some help on how to create BLOBS from byte array?
Could you please help me out on this?

Thanks,
Sivasankar
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56554
    
  14

Moved to the JDBC forum.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26499
    
  78

Sivasankar,
You don't need to create a BLOB object. You can just pass in a BinaryStream (from your byte array) to the Statement.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Shiva Battula
Greenhorn

Joined: Jun 06, 2005
Posts: 20
Thanks Jeanne..Its working..
Sivasankar
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to store and retrieve word file from sybase
 
Similar Threads
Retrieve WAV file from Sybase
Save binary file in DB using entity EJB
Sybase Database to XML
How to store and retrieve word file from sybase
retrieve MS word from ACCESS