Dnyani
Dnyani

Reputation: 1253

How to store more than 10 mb video into MySql Database?

I need to insert more than 10 MB size video into MySQL database. how to do that?
I try following query.

{  
  insert into mscit_video values(1,'bcg',LOAD_FILE('c:\\abc\\xyz.mpg') 
}  

using this query i stored 1 MB video into database successfully, but if i tried
to insert more than 10MB size of video it give following error.

"java.sql.SQLException: Result of load_file() was larger than max_allowed_packet (1048576) - truncated"  

Is posible to store video in database more than 10 MB? if yes then how?
Give me any rference or hint.
Thanks in Advance..

Upvotes: 4

Views: 5567

Answers (3)

Scott
Scott

Reputation: 17037

I'd personally not store video in a database. You're probably better off storing the file location (meta data) in the database of where to find the video file. Then you can store the file in the file system or some distributed file system like S3.

If you still really want to store in a database, try using a LONGBLOB field which should give you up to 4GB of storage.

Upvotes: 2

juergen d
juergen d

Reputation: 204784

You need to specify longblob as data type of your movie column. It can store up to 4 GB

Upvotes: 2

Nadir Sampaoli
Nadir Sampaoli

Reputation: 5555

Notice that the problem here is not the database/table/field's capacity, but the packet sending (I've met this problem before while sending very long concatenated queries, from client to server). Do you have administrator rights on your MySQL database? You might want to increase the max allowed packet size.

Upvotes: 4

Related Questions