aspose file tools*
The moose likes JDBC and the fly likes dealing with images/pictures Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "dealing with images/pictures" Watch "dealing with images/pictures" New topic
Author

dealing with images/pictures

devayani Devasthali
Ranch Hand

Joined: Aug 25, 2005
Posts: 40
Hello All,
I am developing a simple web application. One of my tables contains photographs/images/pictures.
can anybody pls tell me abt how to read them from table also, how to write them also.I am using access / mysql database with tomcat 5
thanx in advance
with regards
devayni
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Sometimes people just store the path to the picture in the database.

If you want to store the picture itself, you can use column type BLOB. How you work with BLOB can depend on your DBMS and any support you're getting from frameworks you may be using (Hibernate makes it easy). With raw JDBC, you can insert a row using a PreparedStatement and its setBinaryStream method (or setBytes, but I haven't tried that). In the other direction, to get the data out of a ResultSet, you can use getBinaryStream (or getBytes, but I haven't tried that either), or getBlob and Blob methods.


There is no emoticon for what I am feeling!
payal agrawal
Ranch Hand

Joined: Oct 11, 2005
Posts: 44
Look at the URL below:

How to store/retrieve image to/from SQLServer
http://www.java-tips.org/content/view/203/29/

Above URL contians an example with SQl server as database with column type as Blob
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dealing with images/pictures