Jyotsana, You can store images as a BLOB. You would get/set them using JDBC. There are methods for byte, binary stream and blob. There are some reasons for storing images in a database. But, if they are images that are part of a web page, you are often better off storing them on a web server.
is it useful to store images in the sql server. My 2 cents. It depends. If your application is image intensive meaning your application that depends on the Database is primarily an imaging storage/retreival app of some sort which would mean that the majority of the data in your database is going to be binary data, then sure. There are also ways to optimize performance on some DB's for image storage/retreival. On the other hand, if you application is primarily data centric and just stores a few images here and there (I would say 60% data, 40% images or less) then storing images along side data in a Database can really hurt your performance. In this situation it would be best to store the images somewhere on the harddrive and simply store reference/location data in the database of where the image is located on disk. Do you like how that really didn't answer your question? As far as "how to.." I found this on Google. It should get you started.
My two cents...with interest: The two cents: I have never been a fan of storing images in a database. Images can really hamper db performance and increase db size tremendously. IMHO, just store the location and filename in the image field like Gregg said and then use that to pull image from file location in your web project or app.
The interest: Opinions are going to vary on this subject. Some will argue that it is better to store all record data in a centralized location. Others, like me, say that storing a reference to the image is worth the extra effort if it will improve performance. Most users do not know where data is stored, and for the most part don't care, as long as the data is accessible.
Good luck in your decision and I too probably did not help you. :roll:
An egg is a chicken's house!
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad: