I will create a portal in J2EE for college students to upload and download data. Data could be any factor like Pdf, doc file, ppt file or could be Image or Video also.

How do i manage Data in database?

Appears like you'll need all ground-up. I'll just give direction, you'll need focus on it, and when there's an issue include specific problem.

  1. Upload files for your file system, or storage, or somewhere like Amazon . com S3. With this use, something similar to Apache FileUpload

  2. Once upload is performed, get the position of the file in which you saved it around the storage-server. Say, /mnt/media/uploads/file.extension

  3. Have your database having a table that stores the metadata concerning the file. Generally it might seem like:

    upload_id | file_name | file_location | user_id | timestamp
    

    where upload_id may be the PK, file_name may be the submitted file's original title, file_location may be the actual full path from the file where it resides inside your storage, user_id may be the uploader's Id, a FK from users table.

  4. The display part: Have your logic to make use of this database to show file_name.

  5. To download, you could have something similar to this How to config Tomcat to serve images from an external folder outside webapps? , observe that this isn't restricted to serving image file. It may serve any kind of file.

Now, you'd question, why on the planet shall we be held doing this much painful things rather than just saving it as being binary data in database? Well, I don't want to dive into discussion, Personally, i prefer this method when i think databases are for data, file-systems are for files. Visit a good discussion here: Storing Images in DB - Yea or Nay?

Hope this can help.

I am likely to guess you don't care what format the information is within (which would be to say, you will not query the information in the database level), by which situation you should think about the binary data types.

I can not become more specific not understanding what database back-finish you are using, however, many common names with this data type are BLOB, binary, varbinary, raw or image.

More here: http://onlamp.com/onlamp/2001/09/13/aboutSQL.html

Keep file within the file system re-named towards the record id in which the file title is saved. This really is less overhead and enables a much better virus checking "you submitted the abc virus".

You may also do methods like storing large files on another server. Backup copies are simpler.