Saber Amani
Saber Amani

Reputation: 6489

Save video stream into the database's table

I want to save a stream video into my database, I want to know what data type in SQL-Server is suitable to save video stream ?

EDIT : Note that, I'm using EF4 as my project ORM.

Any advice will be graceful.

Thanks.

Upvotes: 1

Views: 2985

Answers (3)

BrokenGlass
BrokenGlass

Reputation: 160922

For storing BLOBs such as video data you can use the varbinary(MAX) data type in SQL Server 2005 which is supported by Entity Framework.

Keep in mind whenever you load the entity that contains this column EF will try to fully load your full video into memory, there is no byte streaming mode in EF - this means not only will this not scale well but with multiple users also becomes infeasible because of the memory requirements and will perform poorly. Don't do this - I would look hard for better alternatives.

Upvotes: 1

Remus Rusanu
Remus Rusanu

Reputation: 294307

Download and Upload images from SQL Server via ASP.Net MVC. The article shows how to use streaming semantics for large BLOBs (avoid creating an in memory byte[]) and you ca use the implementation in C# forms just as well, is nothing specific for ASP MVC or web in general.

Upvotes: 1

Davide Piras
Davide Piras

Reputation: 44605

we can assume that a video is basically a file and you can use the FILESTREAM SQL 2008 data type.

there should be plenty of examples around, I found this:

http://weblogs.asp.net/aghausman/archive/2009/03/16/saving-and-retrieving-file-using-filestream-sql-server-2008.aspx

Upvotes: 1

Related Questions