This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Servlets and the fly likes Add Video file to database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "Add Video file to database" Watch "Add Video file to database" New topic
Author

Add Video file to database

Irwin Raja
Greenhorn

Joined: Apr 29, 2012
Posts: 10
I would like to create a database where i can store my video files.. After creation, i want to upload and download these video files from my database from a jsp page... How do i implement this procedure?
Devaka Cooray
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2692
    
    3

Why not placing your videos as files somewhere so each video file has a unique URL and you can store these URLs in the database?


Author of ExamLab (Download) - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
Irwin Raja
Greenhorn

Joined: Apr 29, 2012
Posts: 10
if i consider storing url's, then wen a user uploads a file i wont be able to access it as my database would have only url nd not the actual file..
Devaka Cooray
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2692
    
    3

Does that mean you are not able to access the URLs given in the database?
Irwin Raja
Greenhorn

Joined: Apr 29, 2012
Posts: 10
I can access the url's.. but wen a user uploads a file from his system i would be having the path of the file defined in his system rather than the actual file in my databse..
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2407
Maybe the term "URL" threw you off a bit. What Devaka meant was that you'd store the videos in the file system, and keep only the path to each file in the DB, along with any other metadata about the video in question. Storing actual video data in the DB is probably not the right way to do it.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12268
    
    1
Anyway, databases don't store huge objects such as video files inside the database table structure, that would render table manipulation very very very slow - instead, large objects are stored as separate files with references in the actual database tables.

Bill

Java Resources at www.wbrogden.com
Jack Numen
Greenhorn

Joined: Nov 09, 2011
Posts: 27

Its as simple as this:
Step 1: The end-user submits his file to your system (for how to upload a file in Java you can find lots of examples on Google).
Step 2: You can use your File Api to store/refer/delete that file on your server at the same time store the path of the file in your database column.

and when the user want to retrieve it you are now referring to the file in your server not in the end user machine.

As Tim and William said it is not advisable to store entire file in the database.
Irwin Raja
Greenhorn

Joined: Apr 29, 2012
Posts: 10
thanks a lot..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Add Video file to database
 
Similar Threads
Struts and Multimedia
Play flash video in Java
path issue regarding tomcat server
How to store & retrieve a video file from database?
Retrieving any frame from the video in the database.