aspose file tools*
The moose likes Servlets and the fly likes Save + store images from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Save + store images from database" Watch "Save + store images from database" New topic
Author

Save + store images from database

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3479

Hola guys.
I want to develope a web site for book store, and this will contain description about the book and an image.
my question:
What is the data type should MySQL4.0.4 use for images?
What is the data type for the Description field? (Description may be a big one).
How to save and store the image from the data base? :roll:
Tim Baker
Ranch Hand

Joined: Oct 04, 2003
Posts: 541
you need to save the image into the database as type longblob
I'm not sure about the description one, probably TEXT or LONGTEXT look at the MySQL type docs http://www.mysql.com/doc/en/Column_types.html
to put the image in the database you do something like this:

to get it out you do something like this:

This may not be best solution but this is what I use when I couldn't find any good tutorials on the subject.
[ December 12, 2003: Message edited by: Tim Baker ]

Kim Jong II (North Korea's Dear Leader) said:Nuclear weapons don't kill people, people kill people.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Save + store images from database