Is it possible to store pictures,sounds,videos in

2019-01-27 06:34发布

Is it possible to store pictures,sounds,videos in SQL Database (or any other database) ? If yes what format should it be and please specifiy about the special settings that has to be configured if any. Thanks in advance.

2条回答
唯我独甜
2楼-- · 2019-01-27 07:27

In MySQL you can store any binary content in a table using the BINARY or VARBINARY data type for a column. Quite all database system as such a data type. It can be used to store a full file content such as picture, video, sound,... or just a binary snippet.

Nevertheless, storing binary files in a database is considered as a bad practice, because it quite always brings to disappointments. Indeed, a file stored in database cannot be easily processed for a download, an inclusion in a HTML page, a streaming, ... . And it is quite always complicated to manipulate because of its length. Most often, a file sorted in a database is disadvantageous compared to a file stored in a directory. Its is advised to store the file name in the database base, and save the actual file in a physical directory.

查看更多
霸刀☆藐视天下
3楼-- · 2019-01-27 07:32

Although its generally not recommended to store images inside the Database, its better to store path of the image. Nevethless the images can be stored in the database by using a longblob datatype. Check out this example from MySql forums.

查看更多
登录 后发表回答