Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

1) How to Store jpg in mySQL 2) mySQL not RDBMS? 3

Status
Not open for further replies.

zariya

Technical User
Dec 23, 2003
1
CA
I'm just starting mySQL first time .. I've 2 questions.

1) How can we store pictures (.bmp, .jpg, or etc) in mySQL ? Should we use BLOB type ? Once stored, how can we retrieve that (say, if we pull up John's record, his picture must also be pulled up with his phone# and address)

2) I read on dbForum that mySQL is not (or probably is) a RDBMS. Its confusing for me. Is mySQL RDBMS, i.e. can we define FK in its table.

Above questions are for mySQL 4.1.1 and 4.0.17.
 
Star for you CC.

I agree with CC on the original post too. Tho you can put the images in a blob field there are a number of reasons not to.

1) Table size. Tho normally blobs are not held in the same area as normal table data do to the nature of blobs potential size.

2) Speed. Blobs are slow when you compair them to other data types. Getting the data into and out of a blob takes significant time

3) Rendering. Unless you are playing with a lower level language (ie you are not using vb or a special control to render the image) then you'll have to dump the blob to a file even if it is just a memory file to load it...if you are talking a web application then a physical file must exsist meaning if the same image gets examined multiple times you either need to write it multiple times (Painfully slow) or have logic to check if it is there already (slow too). And in the end some type of clean up routine to delete the file when no longer needed.

All in all it is better to keep the file in the file system and hold the file name. I'd suggest some type of renaming to insure that it is unique.

That is my opinion anyway.....many imaging systems, document management systems, etc follow this suite. The DB holds meta data. The files are held by the file system.



 
thank you --> CajunCenturion & SemperFiDownUnda

> need more info?
:: don't click HERE ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top