This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Java in General and the fly likes Stroring Word Documents into MYSQL Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Stroring Word Documents into MYSQL Database" Watch "Stroring Word Documents into MYSQL Database" New topic

Stroring Word Documents into MYSQL Database

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 495
Hello All,
I am writing a web application that would allow users to upload word Document files, I am using Hibernate to access the MySQL database. Please does any one have suggestion about how i can write the application that is how to store word documents into a MYSQL database
Charles Lyons
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
Word documents are only binary data: you should be able to store them as BLOBs in an SQL database... I don't use Hibernate though, so can't suggest anything there. This is probably better off in the JDBC forum. If you want Web app advice, try the Servlets or JSP forums - as a hint, you'll want to use a form (probably HTML or JSP) with HTTP POST and a servlet to receive the POST data.

Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Charles suggestion is correct. We use BLOBs to store PDF documents but to ORACLE instead of MYSQL. I'm not sure Hibernate can handle BLOB data though I have very little experience with it. And CRUDing BLOBs usually is not as simple as INSERT, SELECT, UPDATE and DELETE. So I too would suggest plain JDBC.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Paul Clapham

Joined: Oct 14, 2005
Posts: 19869

Hibernate works fine with BLOB data, I use it to store images in a DB2 database.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Stroring Word Documents into MYSQL Database
It's not a secret anymore!