Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

store image in mysql using visual jsf in netbeans 6

 
montyfirst disuzafirst
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI friends
i am new to this forum and i came to know that all members of this forum are very great;
can any one tell me how to store image in mysql using visual web jsf .. netbeans 6(ide)

please help asap my project is delayed because of this problem...


:P byeee
 
Lars Arnbak
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know Netbeans or visual jsf..

But storing images in a db, is to some extend, the same as storing text or some other stuff. You have to define the datatype for the field holding the image information/content.

In mySql, table fields for holding image data or object data should be of type blob.

Have a look at what google gives you on that search string:
http://www.google.dk/search?q=Storing+Images+In+MySQL+&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

That should certainly give you a push in the right direction.

Regards.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You normally don't use JSF to store an image in a DB. You normally use JDBC for that.

If your actual problem is that you don't know how to upload a file (image) with JSF, then you should say that so. There are component libraries out for uploading files with JSF, for example Tomahawk t:inputFileUpload. Just get an InputStream of the uploaded file and persist it in the DB using JDBC's PreparedStatement#setBinaryStream().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic