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

How to upload a file to sql server database using struts

 
Vidya Gupta
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am developing an application to upload a file to database.. Actually i don't know which data type to use in the database to store the file and how to store the file in database... please help me..

Thanks in advance
Lalitha.

this is my form bean,

LoginFormBean.java
-------------


I don't know which code to be written in action class to store the data.. please give me some suggestions..
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This isn't really a Struts problem. Your database field should be declared some sort of binary data type like RAW in Oracle. Java has a BLOB object that abstracts access to that type. FormFile has methods to get the file data. You should be able to put the pieces together.
 
Vidya Gupta
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please can any one tell me how to pass the file to any database..
 
Vidya Gupta
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

In my action class i wrote,



I stucked here and i want to store the file in databse..

Please can anyone give me some hints to store it to database.. i am very new to struts..
 
Joe Ess
Bartender
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lalitha Kotha wrote:
i am very new to struts..


Again, this has nothing to do with Struts. Did you look at the BLOB class?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic