> > > Does anyone have any experience storing images in SQL 7.0, 
> > > and retrieving them in CF?
> > 
> > Its far faster, easier and a lot less messy to store the 
> > images's name and then dynamically construct the path
> > information.
>
> I've asked this question before also. And got similar 
> responses as yours which is appreciated. But is there any way 
> you could tell us (a number of people have asked this question) 
> why it's slower and messier. I'm sure for somebody that knows 
> the details on what it takes to do this can logically agree 
> with you (and others who have said the same) and I too would 
> like to be one of those well informed people that come to the 
> same conclusion for the same reasons. Could you or anyone else 
> familiar with the techniques required for this please elaborate 
> on this so I can say something other than "it's a bad idea 
> because that's what somebody said."

There are a couple of reasons that I prefer to use the filesystem for binary
data.

One is that it's not especially easy to read and write binary data to and
from the database from CF. Most versions of CF provide no facility for
working with binary data; CF 4.5.x provides the ToBinary function, but it's
still not trivial to read and write the data. In the past, I've used CFX
tags to do this, but it still was more trouble than it was worth.

Another is that, generally, you don't get much benefit in storing binary
data in a relational database. You're not going to build a query that uses
the binary data as a filtering condition; text-based relational database
just don't provide any useful facility for this.

Also, in my experience, the act of reading and writing binary data from the
database is often slower than reading it from a filesystem. This makes
sense; binary and long-text data isn't stored in the same leaf/page
structure as other data within the database. Instead, the leaf or page with
the selected record contains a pointer to some other data storage location
which contains the actual binary data.

Finally, using the database to store this data is often an unnecessary
bottleneck. If, to return an image, I have to retrieve the image itself from
the database, that's going to occupy a significant amount of CF's time, as
CF receives the image data stream. Alternatively, if I retrieve the name and
filesystem location from the database, CF can often push the work to the web
server, if the files are stored in web-accessible locations. In that case,
CF can be used to find the file name, then write that within an IMG tag, and
that's all the work it has to do.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to