aspose file tools
The moose likes JDBC and the fly likes Storing images in MySQL database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Storing images in MySQL database" Watch "Storing images in MySQL database" New topic
Author

Storing images in MySQL database

niku shah
Ranch Hand

Joined: Aug 28, 2006
Posts: 37
Hi

I am developing Shopping cart , in that clients can also sell their products.

For that purpose products images is to be stored .....

can anybody tell how cani do this ?

well i m using Tomcat , Servlets and MySql DBMS......

Thanks
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3652

It's not a good practice to put images in a database because they can be quite large but if you must, lookup info about blobs/clobs.


My Blog: Down Home Country Coding with Scott Selikoff
anand phulwani
Ranch Hand

Joined: Sep 10, 2005
Posts: 242
Hi Niku,

Set The Image Field in MuSQL To Blob type,and then


Thanks and Regards, Anand
SCJP 5.0 310-055 73%, SCWCD 1.4 310-081 78%, IBM DB2 9 Fundamentals 000-730 62%
niku shah
Ranch Hand

Joined: Aug 28, 2006
Posts: 37
Thanks anand but there is no effect in MySQL database after executing the statement.... ps.setBinaryStream....

if you know how to store image (jpg)file in tomcat's image folder and just path in database columns please let me know...
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

Originally posted by niku shah:
Thanks anand but there is no effect in MySQL database after executing the statement.... ps.setBinaryStream....
Of course there isn't. Just as there would be no effect on the database after executing ps.setString(1, "test"). You have to follow that by executing the PreparedStatement in the usual way.
anand phulwani
Ranch Hand

Joined: Sep 10, 2005
Posts: 242
Here's an example of it,
Hope that would be useful.
The Link
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Storing images in MySQL database
 
Similar Threads
Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
how to insert images in DataBase
Uploading images to database from html/jsp admin page
want to store images to MySQL using Hibernate
Storing Images in MySQL