how to store a file n retrieve a file from mysql database using jsp

sir,
I want to store into mysql database and retrieve it back from database using jsp..
wat data type should we use to store as such file in database and is there any source code available for tat in jsp?
sunda2010Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
TeazerMDCommented:
Hello, you would need to create a field in your database for that.
MySQL has BLOB field type  which is used for storing files.
0
 
allen-davisCommented:
A blob will work but you should consider the performance impact and space requirements over time. Another option could be to write the file to the file system and then store the file path and information about the file (if you want) in the My SQL tables.
The drawback to using the file system and tables together would be when you need to clean up the files. You will need a process that reads the table then deletes the file from the file system.
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
sunda2010Author Commented:
is there any source code available to display the file content which is retrieved from the database in jsp/java
0
 
TeazerMDCommented:
I don't thinks so because you can store there any type of file, meanwhile the browser can display only some specific types of files. I would dare to say that the best you can find is a code that would return the file as a file-stream(so you can download the file).
0
 
siddagrlCommented:
0
 
siddagrlCommented:
0
 
sunda2010Author Commented:
is there any code available to  store a file into mysql db?
0
All Courses

From novice to tech pro — start learning today.