I experimented in different projects, doing this in both directions, and we finally decided that it was easier to use a file system. In the end, the file system is already optimized for storing, retrieving and indexing files.
The only advice I would like to get is to save only the "root relative" path to the file in the database, and then your program or your requests / stored procedures / intermediate product use the root-specific installation option to get the file.
For example, if you store XYZ.Wav in C: \ MyProgram \ Data \ Sounds \ X \, the full path will be
C:\MyProgram\Data\Sounds\X\XYZ.Wav
But you would save the path and / or file name in the database as:
X\XYZ.Wav
Elsewhere, in the database or in the program configuration files, save the root path, for example SoundFilePath, equal to
C: \ MyProgram \ Data \ Sounds \
Of course, if you shared the root of the database path to you. Thus, if you move your installation of the program, you do not need to update the database.
Also, if there will be many files, find a way to hash the paths so that you do not finish working with a single directory containing hundreds or thousands of files (in my small example there are subdirectories based on the first character of the file name, but you can go deeper or use random hashes). It also makes search indexes happy.
CMPalmer Sep 30 '08 at 20:12 2008-09-30 20:12
source share