This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stroring Word Documents into MYSQL Database

 
Abiodun Adisa
Ranch Hand
Posts: 495
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 836
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul Clapham
Sheriff
Pie
Posts: 20176
25
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate works fine with BLOB data, I use it to store images in a DB2 database.
 
Yuval Goldstein
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic