well, let's just say if it crashes it will mean longer recovery time, you are adding extra processing to the SQL server to handle data it wasn't meant to handle, storing it in the file system has the main advantage that if any changes occurs you can change it faster + easier, besides a database is supposed to store essential data so you don't overload it with things that can be calculated or made pretty easily, and I'd say an image fits under that category. And last time I checked my local hard drive is faster than my network connection :) The choice is yours, but if you have heavy load, I wouldn't use it. ---- Andrei Cojocaru [EMAIL PROTECTED] ----- Original Message ----- From: "Sherzod B. Ruzmetov" <[EMAIL PROTECTED]> To: "Andrei Cojocaru" <[EMAIL PROTECTED]> Cc: "Sameer Maggon" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, May 20, 2002 9:37 AM Subject: Re: store JPG in MySQL DB
> > Hi Andrei > > > If I were you I would not store a binary file into the database, I'd store > > the information required to fetch it from somewhere else like the mySQL > > manual suggests > > But what difference does it make? Besides, I found storing it in the DB > more convenient than in the file system. In that case, you will have to > keep track ofboh the files in the file system, and their meta data in the > mysql tables. > > Please advise > > > > > ---- > > Andrei Cojocaru > > [EMAIL PROTECTED] > > ----- Original Message ----- > > From: "Sherzod B. Ruzmetov" <[EMAIL PROTECTED]> > > To: "Sameer Maggon" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Monday, May 20, 2002 12:26 AM > > Subject: Re: store JPG in MySQL DB > > > > > > > > > > For real-life example, check out http://cdbaza.ultracgis.com, and check > > > out the filename > > > of the thumbnails images. I'm SELECTing those images from the MySQL > > > database. > > > > > > That's how it's done: > > > > > > 1_ Create a table to store your JPGs, and the column that holds JPG data > > > should be declared as BLOB > > > > > > CREATE TABLE images ( > > > image_id INT UNSIGNED NOT NULL AUT_INCREMENT PRIMARY KEY, > > > image BLOB NOT NULL > > > ); > > > > > > > > > 2_ Now you are ready to load the JPG data into the image column. > > > I use Perl to open the JPG file and dump the contents into the table, > > > and the resulting query looks something like: > > > > > > INSERT INTO images SET image="here goes contents of the JPG file"; > > > > > > Perl code that does this job would look like: > > > > > > local ($/); > > > sysopen (JPG, "test.jpg", O_RDONLY) or die $!; > > > $dbh->do(qq|INSERT INTO images SET image=?|, undef, <JPG>); > > > close (JPG); > > > > > > Sorry if you don't know Perl, but you should be able to do similar > > > thing in any other language you might be using > > > > > > > > > > > > Good luck! > > > > > > -- > > > Sherzod > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > Before posting, please check: > > > http://www.mysql.com/manual.php (the manual) > > > http://lists.mysql.com/ (the list archive) > > > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > > To unsubscribe, e-mail > > <[EMAIL PROTECTED]> > > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > > > > > > > > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php