Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to store and retrieve word file from sybase

 
Shiva Battula
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone help/provide me some examples/URLS to store and retrieve word file from sybase database in Jsps/Servlets?
Thanks,
Sivasankar
 
Rusty Smythe
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65340
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the JDBC forum.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sivasankar,
You don't need to create a BLOB object. You can just pass in a BinaryStream (from your byte array) to the Statement.
 
Shiva Battula
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne..Its working..
Sivasankar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic