This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to send files stored as blob in mysql as attachment

 
Joshua Cloch
Ranch Hand
Posts: 95
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,thanks for your attention.

Here is my question:

Now,in my website I can upload some files into MYSQL DB,and I want to select some of these files as attachment to be sent to customer.
I know it is very easy if the file is stored as a file in a particular directory,what i need is to get the path of the file and then use a javamail function "attachFile(path)",how can i do it when the file is stored as blob?Is there any javamail function which can be used to manipulate this process?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Other Java APIs where the Javamail gurus hang out.
 
Paul Clapham
Sheriff
Pie
Posts: 20177
25
MySQL Database
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read the BLOB into a byte array in your program. Then use a ByteArrayDataSource to attach it to the message.
 
Joshua Cloch
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,I will test it on next monday.
 
Joshua Cloch
Ranch Hand
Posts: 95
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works pretty good.Thanks again!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic