# Help: Store video/image files in database



## speedyguy (Jun 29, 2011)

not comfortable with blob datatype and its use... im doing a dynamic web project in j2ee so need to store and access images and videos from database to my web page (html/jsp). can anyone help me out with that.

ps : im using sql querries for database (DB2)

Enjoy~!


----------



## furious_gamer (Jun 29, 2011)

^^ Storing images in DB is not good idea unless it's the photo of employee or anything similar to that. get the image using normal File input and use BLOB. Otherwise store images under a folder and name it with your primary_key . filename. very easy to pick the file instead of retrieve it from DB and way easy to store.


----------



## speedyguy (Jun 30, 2011)

ok not very clear to me still. but im more concerned with storing video files rather than images. ya images might also come into picture.

Enjoy~!


----------



## furious_gamer (Jun 30, 2011)

^^ See if video files, i would not suggest you to store it in DB and no way you can store it in DB. Yes, create a folder in server and create folders according to whatever criteria you need to store them.

Ex. If facebook like app, i would store images like server_path/user_images/user_id/

under this folder three subfolder named profie_pic, gallery(again sub-folders) and video.

Under this video folder i'll store whatever video he uploaded.

This is the fastest and correct way to do. In the meanwhile, refer the video name in some tables, so that user can search for the video name and play it. This way, you can fetch the video names from DB and when user click on link, retrieve the video from folder.


----------



## speedyguy (Jul 1, 2011)

alright...im deploying my project websphere tomcat. so can i get that folder automatically exported into some subfolder or manually i do it?

Enjoy~!


----------



## furious_gamer (Jul 1, 2011)

^^

Write the code in such a way that if that folder doesn't exists, create one. In this way no need to export things.


----------

