Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database

free web hosting
Free Web Hosting > Computers & Tech > Databases

Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database

anzoone
Hello to all of you beautifull people out there, I am new to MySQL, i just wanted to know if its a good practice to directly store images and other binary files in a MySQL database. Any one with help? Thanks

Reply

TavoxPeru
QUOTE(anzoone @ Jan 23 2007, 04:58 PM) *

Hello to all of you beautifull people out there, I am new to MySQL, i just wanted to know if its a good practice to directly store images and other binary files in a MySQL database. Any one with help? Thanks

Well, in these days where we can get incredible storage devices -hard disks, dvds, cds, etc.- with huge capacities, i dont know exactly if it is a good practice to do that because i dont have any statistics about it, i think that it is not a problem to store binary data directly in a database.

Personally i don't do that, in all cases that i know that i gonna deal with this situation i always prefer to store in the database only a reference to the image or binary data using a string fields to alocate its file name and folder name.

Best regards,

Reply

uapconsole
It is a practice used by many developers I know. It is possible to store a binary image file such as a .jpeg or .gif. However, I recall working on a project where doing this was the "easy way out." However, I recall this solution tends not the be the most efficient way of doing things.

When my colleague and I tried this, we noticed that the SQL databases became very large. Furthermore query processing tend to be slower. Things just felt "sluggish." We did not think anything was wrong, as we've read that it was a legitimate practice to store images directly, in binary, in the SQL database. However, further research revealed that there is a more efficient way.

We dumped all the images in a read-only directory. We simply converted the "IMAGE" column field to "IMAGE_PATH." We simply stored the paths of the images in our "image dump" directory under this field.

So, we simply pointed the SQL database in the right direction, when an image query is made.

The database behaved much better after these modifications. Everything just felt more efficient.

Hope this helps, good luck.
- Demirelli

 

 

 


Reply

Quatrux
Yeah, in my practice I found that it is much better to store your images as binary files somewhere and not in a database like mysql, because it is much faster for apache as a httpd server to just transfer a binary file to a user with the right headers, same with a html file or any other file which doesn't need parsing, for example php. Using extra resources, like mysql database, which requires different sql querys, imagine you need to show to a user 10 or 20 images at one request.. imagine you have 100 MB of pictures/images..

Besides, it is much easier to organize your pictures when they are stored as binary files in some directories, you just upload them and similar, you can give an id for every image if you want to or if you don't want to show the image directory, you can worj with the image using a language like PHP.. you won't need to waste time to store the images into databases, you won't need to waste time to see what you have in a database if talking about images or other binary media. Imagine you have a database with 20GB of images, you would have a lot of problems, due to making backups or restoring backups would be hard, repairing tables would be hard to or would take time and etc.

The only good way of storing binary data to a mysql database for me is that if you have a very big site or something, which requires a lot of resources and you can spend money for a mysql server just for binary data, when it is a very good way, because all the other servers which are running can get the image by making a mysql query and if you have 20 servers, you don't really need to have the images stored (imagine if images take over 36GB) on every machine, you save space that way, but for simple developers and websites, I don't see anything good about that. wink.gif

Reply

yordan
Have a look at the way, here offered by astahost cpanel, the 4image system works.
In the mysql database are stored the data and the indexes describing the images and the path to have the images and which thumbnails are associated with, and where the thumbnails are, and the guest's comments. Each set of database data points to the place where the htmls images are stored, these are subfolderes named 1, 2, 3, etc.. in the "media" folder, so everything is inside the Unix or windows fileystem.
so, the php programs offer the logic, the mysql database offers the data organizing, and the data are in filesystems. This is the ideal combination of the stongpoint of each component.

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Recent Queries:-
  1. cache:eqehdshsyawj:www.astahost.com/info.php/mysql-overhead_t19417.html mysql data type for images - 320.73 hr back. (1)
Similar Topics

Keywords : good, practice, store, image, binary, files, directly, mysql, database

  1. Organizing C++ Project Files For Large Projects
    (source code, header, makefiles) (4)
  2. Small Issues About Mysql Connector/j 5.1
    (2)
    Hi, all, I just downloaded some versions of mysql Connector/J mysql java driver to test some
    stuffs. There is an issue about the lastest version of 5.1.7. It don't work correctly on older
    version of java 1.3.1. But an older version 5.0.x works without any issue. Hmm... anyone have ideas
    about this ? Testing with 5.1.7 CODE C:\org>java -Xverify:none program Exception in thread
    "main" java.lang.NoSuchMethodError         at
    com.mysql.jdbc.ConnectionPropertiesImpl$BooleanConnectionProperty. (ConnectionProper
    tiesImpl.java:73)         at com.mysql.jdbc.Connect....
  3. Free Online Adventure And Rpg Games
    Good for Teenagers (4)
    Some recent websites I have heard about for teenagers and young adults are: Habbo Hotel (A vitual
    world where you can create your very own character, create rooms, and chat to other people.)
    Runescape ( Another Virtual world where you can fight other players, chat, collect items and do
    quests that are around your choosen world) IMVU ( A world where almost EVERYONE between 13 and 60
    can talk and make new friends, create an awesome webpage or even shop for clothes for your
    character) These games are good for rainy days or just if nobody's home and you want some o....
  4. Good And Free Sites To Advertise
    (0)
    Easyhits4u: Its simple, you surf other websites with two options, 15seconds per surf or
    20seconds per surf. If you are unpaid you get 0.5 credit for the 15 second surf and 1 credit for the
    20second surf. If you are paid you get the whole 1 credit for 15 seconds. There is also surfing for
    30 seconds (1.5 credits) or 40 seconds (2 credits) but you can remove them from your surfing cycle.
    Once you earn credits you can either convert them to banner impressions, 1 credit gives 15 banner
    impressions if you are unpaid, 20 if you are. Or you can convert them to site views, y....
  5. Sql*plus On Your Pc
    Connecting to a remote database (3)
    1. INTRODUCTION. Most of you are familiar using Oracle sql*plus, in order to perform very
    simple queries, or writing down complex sql scripts. In order to do that, you usually simply rlogin
    or putty to the remote Unix/Linux machine and run your queries in a command-line prompt window. When
    you want to create complicated (at least several-lines long) scripts, or test the reproducibility of
    a table/index creation script, you start it on the Linux remote system. If you want to modify it,
    you get it back on your PC, modify it with your favourite developer’s program ....
  6. Login System
    I want to make a login system using Mysql. I am amateur in these thing (6)
    I want to make a login system using Mysql. I am amateur in these things so please explain in detail
    like spoon feeding. I have already made a database in http://www.sitebooth.com now what type of
    table I should make and and the website or PHP for it . If you think i hav chosen wrong site please
    give any better database hosting site. Please help me Best Regards Pritesh Gupta....
  7. Free Or Opensource Database/schema Browser?
    Alternatives to TOAD or PL/SQL Developer (6)
    I was wondering if there were any alternatives to TOAD or PL/SQL Developer that allows you to browse
    through a database(s), the different schema objects, and perhaps the stored
    procedure/function/packakge editors. One thing I have tried is to the use the Data Tool Plugins set
    for my Eclipse but that brings my machine's performance to crawl. One a further note, I am
    basically looking for Windows environment, with connections to remoate databases.....
  8. Which Language Is Easy And Secure Today For Web Development
    is PHP MYSQL is easy and Secure ? (2)
    Web development Application now a day using PHP MySQL Mostly as i observed on discussion topics on
    Forums friends switch to PHP MYSqL, Did PHP MYSQL is Easy and Secure for todays environment what
    you are say about this Hacking tracking stolen password are very much popular now a days his website
    hacked by X person so many time comes to news please emphasis on security issue when you go to
    develop any web tools . what is the right way to tight security on PHP what thing i kept in mind
    which logic i use that any one can not hack webtools. when i was use java/j2ee languag....
  9. 12 Javascript Image Galleries
    (0)
    While I was looking around and searching for a good online gallery for a client of mine, i stop by
    into this article 12 Javascript Image Galleries that offers some of the better Image Galleries i
    found. All of these Image Galleries are Javascript, CSS and Ajax based solutions, so be careful and
    take in mind that if Javascript is disable they will not work. Aditionally, some of them are server
    side -PHP- based also. If someone is in a hurry and need to check them out here is the 12 Image
    Galleries collection posted in the article: (E)2 Photo Gallery Made With Mootoo....
  10. 10 Things Standing Between You And Feeling Good
    The 10 Mental Distortions of Cognitive Therapy (3)
    In his book, Feeling Good: The New Mood Therapy, Dr. David Burns discusses the 10 ways of thinking
    that are responsible for most of our everyday emotional problems, particularly depression, guilt,
    and self-loathing. He called them The 10 Mental Distortions. Dr. Burns derived this list of
    mental distortions from the relatively new, but very promising, field of Cognitive Therapy.
    Cognitive therapy is a school of psychotherapy that is based on the premise that our feelings are
    primarily dependent on, and directly related to, our thoughts. And so, by modifying the way w....
  11. Best Database
    (13)
    What is the best free database if some one trying built a social networking website? And how to
    operate it with dreamweaver 8?....
  12. Image Problems With Windows 2000
    (10)
    Hi, since a while i got two problems related with images files in my Windows 2000 machine, both are
    very closely related because them happen with Windows Explorer and with Internet Explorer 6. The
    problems are: Windows Explorer Thumbnails Preview : The problem with this option of the View menu
    is that it doesn't show any thumbnail preview of any image in my hole computer, i verify this
    problem for jpg, jpeg, gif, png or bmp files, but it works fine and generate the thumbnail previews
    for html files. IE Save as... dialog and JPG files extension : Every time that....
  13. Friends Can't Start The Exe Files I Send :(
    (5)
    I am using visual c++ 2008. and when I send the .exe file that I created to my friend, (from the
    debug folder) he gets an error message when trying to execute it /sad.gif"
    style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> any ideas? when my friend
    tried, he said that he got the following error message: cannot execute .... And lots of PC info.
    When I create these files, I choose win32 console application (something that looks like the cmd
    when executed) please.. I really need to get this thing working Thanks //Feelay....
  14. Two Flowers?
    Don't have a good name. :P (5)
    V1 V2 V3 yu liek? raet mbz? I just noticed, I messed up on the borders, I'll fix that
    later. I'm too lazy ATM. /tongue.gif" style="vertical-align:middle" emoid=":P" border="0"
    alt="tongue.gif" />....
  15. Php Tutorial: Making A Shoutbox
    Requirements: PHP, MySQL (12)
    Hi everyone, I'm going to tell you how to make a simple shoutbox using PHP and MySQL. To start
    off, open up mysql in the command line, or phpmyadmin, and create a database called shoutbox. Next,
    enter the following sql into the command line, or the phpmyadmin sql box, while using the shoutbox
    database: CODE create table messages(author varchar(30), message text, time timestamp, mid int
    auto_increment, primary key(mid)); This creates the table we need to store the messages, note the
    "mid" column, this gives each message a seperate id number, we'll see why ....
  16. Hiding Your Personal Files From Pros
    More serious approach to privacy (9)
    Inspired by this thread, I decided to launch this one to see how you folks approach the issue of
    securing your private files at work or at places where computer-professionals can access the machine
    you use. Following is my response to ethergeek's post in the aforementioned topic:
    QUOTE(ethergeek @ May 14 2007, 06:46 PM) 103520 The best way to hide your private files is to
    not keep them on machines that aren't yours. I agree with that completely. Such machine could
    always be taken away from you without prior notice, with the files you care about in ....
  17. Ajax + Php + Sql = Simply Superb! ( With Visitor Tracking )
    A small tutorial to explain integrating php, ajax and MySQL Database (11)
    Hi all.. I'm back with a new small tutorial! Introducation A tutorial to integrate
    Ajax, Php And Database ( Im using MySQL) + Visitor Tracking! Here you can enter values to some
    input fields, and by clicking some enter button, ( or u can call the function on some other event)
    those values will be sent to the database, along with visitor details ( IP Address, Input Value,
    Visitor Agent etc)! Those values will be stored in some database and you can retrieve the same using
    some simple php code and even deleted some rows from those databases! Requiremen....
  18. CuteNews: PHP-based Blog System - No MySQL
    (11)
    I don't know if you guys have heard about CuteNews, but I think it's an awesome blogging
    system. If you don't know where to get it or how to set it up, here is a quick run-down.
    Download the zip file (virus free) from http://www.mysharebox.com/dl.php?key=8276639 . 1) Unzip
    the file. 2) Make a folder titled "cutenews". 3) Upload the contents of the cutenews folder into the
    one you've just created. 4) CHMOD the file index.php to 777. 5) CHMOD the folder "data" to 777.
    6) Then CHMOD all the files and folders inside of "data" to 777. 7) Go to http://YO....
  19. How To Open .bam Files !
    (5)
    Part 1 Extracting files PLEASE DO NOT COPY ! This links with my other topic to 5.6 bams ,
    Loads of people have asked me how do you get pview , extract .mf files. Well im going to show you
    all in one. 1. Download Panda3D v.1.1.0 from here Start Picture Totorial Again, ugggh
    ! 1. Navigate your way to where you installed Panda3D ( It is usually : C:\Panda3D-1.1.0 )
    2. Open the bin folder in the Panda3d directory 3. Find and copy Multify.exe and PView.exe
    4. Paste the Files to the desktop 5. Navigate your way to C:\Documents and s....
  20. MySQL For EasyPHP Users
    Does anyone use this program? (5)
    I installed a program called EasyPHP because it was an easy install and I wanted to be able to learn
    php and still be able to down the road learn MySQL. But I can't figure out how to use MySQL.
    Does anyone out there use this program that could tell me alittle about it. Alot of the product
    site is written in a different language, but everything on the program is english so that is good.
    Any help would be appreciated.....
  21. How To Embed Swf Files In Joomla ?
    (10)
    I want to embed some swf game files into my Joomla project, I've been at it for two hours and
    haven't made much progress. I've tried making a new content item and placing ... but that
    hasn't worked. I'm kind of stuck /sad.gif" style="vertical-align:middle" emoid=":("
    border="0" alt="sad.gif" /> Anyone familiar with Joomla or Mambo that may have some knowledge
    regarding my issue?....
  22. How Can I Delete Old Files In Windows Xp ?
    HELP!!! (22)
    I've just reinstall my system. But I can't delete old profiles in C:\Documents and Settings
    . I have the Admin right, of course. But... the system don't allow me to delete the files.
    I need to free up some space on my hard disk. (That folder's size is up to 12GB)....
  23. Renaming Files (Using Excel Spreadsheet)
    (22)
    Hi, I want to use filenames on my Excel Spreadsheet for the files I have in my folder. For example,
    let's say I have these in a folder: Reportdummy.doc Charts102.xls DecemberGraphs.xls
    TestScrap.txt etc... And I have this in my Excel spreadsheet: Report1.doc Charts.xls Graphs.xls
    Scrap.txt etc... Is there an easy way for me to copy the cell's value to the file in that
    folder? I want them to be copied exactly in that order. So far I have to do this manually (copy
    from Excel, then rename and paste for each file). Thanks.....
  24. Www.rapidshare.de
    a good place to place your files ! (23)
    This is a site people does not know as it deserves to ! It's simple : You can upload any file
    you want (50Mb limit, but split archives are allowed) without even needing to register ! How ?
    Simple : at the main page there are 2 small boxes : Chose and Upload ! First you chose wich file you
    want to upload, and then you click upload and it will be uploaded ! After that you will get the
    file's link and a destroy link, wich means that if you want to erase the file, you should clik
    that link ! If another person wants to download your file, you give them the file'....
  25. Is It Worth It To Get Gmail ? Is Gmail Good?
    (92)
    Hi, I've been debating for a while about getting Gmail, but a few of my friends said it was
    horrible. I would like to know if it is really worth it getting another email account. What are
    the benifits and the bad things, too? Thanks, Erich B /cool.gif' border='0'
    style='vertical-align:middle' alt='cool.gif' /> ....
  26. How To Play *.rm Files With Media Player
    (14)
    How to play Real audio and video files (*.rm) with Windows Media player!? /blink.gif' border='0'
    style='vertical-align:middle' alt='blink.gif' /> Because of competition between Microsoft and Real
    Networks, Windows Media Player does not support Real audio and video files, and real networks does
    not release any patch for WMP. But, Real has released a patch for other media players. Now, I want
    learn you, how you can use this patch to play Real audio and video files. You should have Windows
    Media Player and Real Player: 1- First go to sourceforge.net website and download....
  27. How To: Connect, Read, Write, Close A Database
    VB.NET (5)
    Here is a tutoral or a novice programmer. This tutorial assumes you have a basic knoladge of
    databases and VB.NET. It also assumes that you have a MS access database named Testdb.mdb with a
    table called "Table1" that has at least one column called "Col1". You must start with a form with
    one label on it. If you need any help email me at bob3695@gmail.com. The first step is connecting
    to the database. The first thing you must do is add the ADODB reference. To do this in the
    "Project" menu click "Add Reference" then select ADODB from the list and click "Select". The next....
  28. Looking For A Good C++ Compiler
    I'm hoping to get a URL to get C++ (18)
    Hey! I'm looking for a website where I can download a good working C++ compiler. Even if its not
    a download site, at least a place to jsut write small programs would be nice. I have no intentions
    of making anything big; I just like to program in my free time. Also, I'd prefer they are free,
    but if anyone else is looking, they may not mind paying. Alright, Thanks!....
  29. Anyone Know Any Good Mmorpg Games?
    (70)
    anyone know any good mmorpg games? any free ones? i played runescape and it wuz cool for about 6
    months........
  30. IE6 display:block hides other image BUG
    (1)
    Hi everyone, I have a problem. I have two images, and one has the 3px IE bug. Turning this to a
    block level element fixes it but then an image to the right disapears. Another fix I have tried is
    an IE hack with -3px margin which makes the bottom line up but then the top is off. Here is the
    CSS in question.
    code:--------------------------------------------------------------------------------#masthead {
    width:100%; background-color:#4F6DB1; background-image: url(../images/layout/blg_gradient.jpg);
    background-repeat:repeat-x; } #logo { position:relative; z-in....

    1. Looking for good, practice, store, image, binary, files, directly, mysql, database






*SIMILAR VIDEOS*
Searching Video's for good, practice, store, image, binary, files, directly, mysql, database
Similar
Organizing C++ Project Files For Large Projects - (source code, header, makefiles)
Small Issues About Mysql Connector/j 5.1
Free Online Adventure And Rpg Games - Good for Teenagers
Good And Free Sites To Advertise
Sql*plus On Your Pc - Connecting to a remote database
Login System - I want to make a login system using Mysql. I am amateur in these thing
Free Or Opensource Database/schema Browser? - Alternatives to TOAD or PL/SQL Developer
Which Language Is Easy And Secure Today For Web Development - is PHP MYSQL is easy and Secure ?
12 Javascript Image Galleries
10 Things Standing Between You And Feeling Good - The 10 Mental Distortions of Cognitive Therapy
Best Database
Image Problems With Windows 2000
Friends Can't Start The Exe Files I Send :(
Two Flowers? - Don't have a good name. :P
Php Tutorial: Making A Shoutbox - Requirements: PHP, MySQL
Hiding Your Personal Files From Pros - More serious approach to privacy
Ajax + Php + Sql = Simply Superb! ( With Visitor Tracking ) - A small tutorial to explain integrating php, ajax and MySQL Database
CuteNews: PHP-based Blog System - No MySQL
How To Open .bam Files !
MySQL For EasyPHP Users - Does anyone use this program?
How To Embed Swf Files In Joomla ?
How Can I Delete Old Files In Windows Xp ? - HELP!!!
Renaming Files (Using Excel Spreadsheet)
Www.rapidshare.de - a good place to place your files !
Is It Worth It To Get Gmail ? Is Gmail Good?
How To Play *.rm Files With Media Player
How To: Connect, Read, Write, Close A Database - VB.NET
Looking For A Good C++ Compiler - I'm hoping to get a URL to get C++
Anyone Know Any Good Mmorpg Games?
IE6 display:block hides other image BUG
advertisement




Is It A Good Practice To Store Image Or Other Binary Files Directly In A Mysql Database