Sunday, March 11, 2012

Dumb Data Storage Question

Hello,

So, here's my dumb question; if I wanted to store some *.gif images in some database (SQL2K possibly 2K5) field and wanted to pull the information from that to display on the web form, am I actually storing the image in the database or am I storing the location of the image in the database?

I ask this because I was under the impression that the location to the image file is what was being stored but another person was saying that it was the actual image. I guess I'm confused...

Thanks in advance...

You could do either. If you are not sure check the datatypes of the columns in the table. If its a varchar(50) obviously its only storing the path. You can also do a select from the table and see the values in the column. If you see some hexadecimal values its an image. if its a path you can see it right away.|||

So if I wanted to store an the actual image in a DB table, I'd store it as a hexidecimal date type, correct? That makes sense...

So in order to get that image into the table in the first place I could just do an upload from a web UI, correct?

Thanks!

|||Kind of. Please check documentation regarding Image data types. Also do some googling and understand the consequences of storing images in databases. Databases are better storing data than images.|||

Cool. Thanks.

I agree with you, for whatever that's worth. I would have just put a location path in the db to pull the images in but thought if you can just store the whole image, why not do it that way? But I think the path is the way to go. especially if you've standardized the path of the images to a specific location.

Thanks again!

No comments:

Post a Comment