Clearly most replies are opinions but it
is nice when people post the
rational behind.
Agreed. It's always nice to get a bit of an explanation for solutions to
problems.
but I intended to ask him what he thought
the advantages might be for storing them in the database
Again, my bad for not asking the them to be a little more specific about the
requirements before posting my reply.
What advantages or disadvantages there may be depend on the requirements,
something that wasn't explained to either of us. I might have been wrong to
give pros and cons without the requirements (or providing my own explanation
for the pros and cons), but "I can't think of many..." is bordering on one
of those 15 second answers you mentioned (see why at *** below)
how does he get 10,000 images into the database attached to the
proper records?
The same way he gets 10,000 records in the database to point to the correct
files (although a bit slower because of the data transfer).
I would have guessed from the short
description that users wouldn't directly
upload files. So that's interesting.
I don't know your experience with applications that do this, but I guess I
was swayed because I recently implemented a solution to upload files to a
central location and chose to go the database route.
I don't think I get this. But anyway, I
would guess that a user could
select only from records in the database.
Yes. The solution I implemented stored the documents on a server. To view a
list of the available documents, the user queries the database (not the file
system) for descriptions of the files. If there isn't any record for the
document, there is no way to get the document (unless you stored outside the
db and could get to the file going "behind the scenes" of my server
application).
I guess the two different types of applications that could be implemented
are as follows (regardless of where the files are stored):
1) Where the database complements the files - i.e. The user has a set of
files and then an auxiliary database designed to provide descriptions of the
files.
2) Where the database controls the files - i.e. The user has a set of files,
but wants to *copy* them to a central location. The database stores
descriptions of the files and provides the only index to the location of the
copied files.
If it isn't in the database then
it doesn't qualify for downloading
and/or viewing. It doesn't matter if the
an image is sitting in folder... I have
images sitting in folders on my
webserver, you can't get them
This depends on the pattern implemented (1 or 2). If pattern (1) is
implemented, then there is no point storing the files in the database and
copying them needlessly. If pattern (2) is implemented, then there are both
advantages and disadvantages to storing within the database. Depending on
the requirements, the disadvantages may outweigh the advantages, or vise
versa. In any case, pattern (2) requires that the files be copied - if they
are stored in the database or on the server's file system doesn't matter to
the user - as far as they are concerned, they copied the file and the only
way to get to it is by querying the database.
Pattern (2) also requires that the database and files be kept in sync all
the time. If you're worried about deleting an image, but loosing the actual
image data, then you shouldn't delete the row from the database - simply
mark a "Deleted" field as true or something.
That's why I'm doubtful that storing
the 10K images directly in
the database is a good idea.
To be sure, it might be a great idea I just
(so far) don't think so.
It depends on the requirements and how you weigh up the pros and cons based
on those requirements.
I see now... it was intended to be an
invitation for discussion. Rather
than post "I think this... or that"
I thought I might find out what the guy
with problem had thought about so far.
*** I see that now, but your post could easily have been taken for one of
those 15 second answers (as I took it by mistake). Maybe a direct question
would have been better...
It isn't you Trev... it is the way people post
stuff in general.
It was partly me... I posted a response based on wide ranging assumptions.
That's another type of posting I'd like to see an end to.
That's one of the reasons
"which computer language is best" type
questions generate so
much heat and so little light.
lol. I never heard anybody put it better. We've all seen too many of those
posts lately (and I've always tried to narrow my answer down to "base your
choice on your requirements").
Thanks again for the discussion.
Take care,
Trev.