mike smith-croteau wrote: I wasnt sure about saving to database but every now and then I come across a development article which shows saving image as byte array...
Development articles are often demonstrating useful functionality (storing binary data in a database) at the expense of Best Practices (do we REALLY want to do that?).
mike smith-croteau wrote:
so always left me wondering if there was a performance advantage or something. Do you know of any advantages to saving to database?
I have not done any benchmarking, so take my opinion for what you paid for it: if one loads a file from the file system, the overhead is finding where the file is opening it and reading it. If one loads from the database, there is the overhead of making or getting a database connection, creating and executing a query, locating the image in a table (which is usually stored on disk), reading it into memory if necessary and transferring it across the database connection. In my mind, file system wins.
There would have to be some very important requirement to get me to store an image in a database (associating metadata with the image that would be too complex for a property file, for example). And even then, I'd probably store the metadata in the database and the image on the filesystem.