The moose likes Object Relational Mapping and the fly likes Stroring Word Documents into MYSQL Database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "Stroring Word Documents into MYSQL Database" Watch "Stroring Word Documents into MYSQL Database" New topic
Author

Stroring Word Documents into MYSQL Database

Abiodun Adisa
Ranch Hand

Joined: Jan 17, 2002
Posts: 493
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
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 832
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 SCWCD 5 Study Companion 2nd Edition (ISBN 0955160332 / Asian 2nd edition)
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
Bartender

Joined: Oct 14, 2005
Posts: 13842

Hibernate works fine with BLOB data, I use it to store images in a DB2 database.
Yuval Goldstein
Greenhorn

Joined: Dec 27, 2006
Posts: 18
Hi Guys,
Its true you can use LOBS but actually there are some considerations not to keep the documents at the database at all but to keep them on the file-system.
If you require access to these files form several servers, you will not to store them on some storage that is available on the network (NFS, SAN, NAS)

- Inserting and reading large BLOBS (more that several MBs) suffer from low performance, sometime even horrible performance.
- The file system is already a sort of a database. It has an hierarchial structure to keep files and it is build for file access. In many cases you will want to search or access files according to their directory tree ( /users/documents/word/my.doc ).
- If you would like users to download these files, it is best you have in a 'download ready state', without having to read them by code and send them as bytes over some servlet.
- You cant look at files content when they are in the database, sometimes, this is an issue.

Many content management software solutions keep files on the file-system and file meta-data in the database (such as the file-name, author, upload time and such).

Goodluck
 
IntelliJ Java IDE
 
subject: Stroring Word Documents into MYSQL Database
 
Threads others viewed
Retrieve documetns from Oracle DB
Error opening document in Office2000
To store files/images in a database or not
Converting Blob to word
Stroring Word Documents into MYSQL Database
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture