Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to store /retrieve image to/from MS ACCESS

 
Sameer Chandra
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am developing a GUI (swing) that will store data (txt and images ) into MS Access database. In MS Access , images can be stored as OLE object. Can anyone please tell me how to retrieve images from ACCESS ?

Thanks,

SAM
 
Rob Spoor
Sheriff
Pie
Posts: 20753
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More of a JDBC issue.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read about CLOBs in the JDBC tutorial yet?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Images are binary data, don't use CLOB. Use a BLOB. Create a binary field in the database and use PreparedStatement#setBinaryStream() to store it and ResultSet#getBinaryStream() to retrieve it. Not sure if that is supported by MSAccess as well as it isn't a decent database. Otherwise either upgrade to a decent RDBMS or store the images in the file system and save the path in the database. After all, saving binary data in a database may improve portability, but it doesn't make much sense as you cannot index and search it in the DB.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic