Jump to content
  • Advertisement
Sign in to follow this  
Ekim_Gram

[web] Storing music files and images in a MySQL database?

This topic is 4833 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Guest Anonymous Poster
I asked a friend this question a few months ago and he wanted to beat my head in (he managed a database of several million users). So I'm assuming if it's going to be accessed a lot (if you're thinking MMO* like most people seem to be lately) then I'd say no. Bandwidth requirements would kill the database (my understanding).

Share this post


Link to post
Share on other sites
Actually it'd be for web stuff like uploading a picture and giving it a corresponding caption or an .mp3 with a description.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I'd still say no, if your site gets slammed it would be the single point of failure. From my understanding MySQL wasn't designed to be an FTP server. But I could be incorrect also, just doubt it after the lecture I got from my friend... *shrug*. Your milage may vary.

Share this post


Link to post
Share on other sites
Its been a while so the techniques may have changed but if I recall what you want to do is use the SQL server like a hash lookup table. Basically what you want to do is tag the resource name and then organize you resources by indexing them. So when you 'compile' the page for the user, you have an index for the media file, the label, caption, etc... and then the middle-layer pulls these resources together (data from the db, large text from a doc repository, media from a file server).

It means a lot more work but its the way you will have to go. Almost all dbs are not going to like 5mb media files and the ones that might are basically going to store the file in a share and index it with a key (if I recall, Oracle soes something like this).


Share this post


Link to post
Share on other sites
Short and simple, possible yes, how? Google. Short and simple, NO!

Why do you need a DB for Images and Sounds? Well that would be the same reason you need to store any data type in a Database, and that is to maintain relationships between said bits of data, provide indexing…

NTFS is a pretty quick file system, why not use that on a server. If you’re even talking about a server. Perhaps your wanting a database to store files locally. Who can tell.

Open source and free does not equal, good and fast. If you really did need to use a database to store large binary data types, MS SQL Server (or other big $$$ enterprise product) is really the only way to go.

This may make you very sad. It made me very sad when I was setting up a company and was looking at a $20’000 per CPU licence, I kid you not.

If your still interested search google for “blobs sql”

Share this post


Link to post
Share on other sites
I've done something similar (it was storing images in a database so they could be associated with a particular thing on the website) and the way we did it was just to store a reference to the object as a string in the database (eg "www.mysite.com/images/image.jpg" or "./images/images.jpg").

The problem with this is that your script needs to do a bit more to get the data to the user (put it in <img> tags for example) but this was fairly simple to do

Share this post


Link to post
Share on other sites
Contrary to the above, I say go for it. Database engines these days are approaching the speeds of file systems.

But you really need to ask yourself "why do I need a database for my online game"?

If you're not building a game, and you're making a content management system, storing images and sound in a database are a great idea. You can store all kinds of metadata, make it so leechers can't steal your bandwidth, etc. But, if you are continuously accessing an image (like a banner), it's probably a bad idea, as it's really not worth it to store any extra metadata about a header image.

It really depends on what you are trying to put the images and sound files in the database for.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Store a link to the files needed?

eg. For a hypothetical image you wanted to "store" in the database.



3 things here would be stored in the database
1. /images/logo.gif
2. 276
3. 110

The actual image would be stored somewhere else. The database simply stores the location/height/width of the image.

I should make an account :P
Hope this helps
~icecoldtears~

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
In my previous post it didnt show the html tags in my example, so i'll repost here without the pointy brackets

img src="/images/logo.gif" width=276 height=110

If i had an account i could have just eddited
~icecoldtears~

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!