2

I have several files on a webserver (not stored in the database). I'd like to store several information to this specific file. The user should be able to post comments about this file.

My question is:

What is the best way in order to store information in a database in addition to a file that is stored on a webserver... How do I connect both parts?

8
  • My first thought was to create a table with two columns, one fo the filepath, another to store comments. If you need multiple comments for each file, then you need to have a slightly different table(s) design. Nov 28, 2012 at 14:01
  • @SQLRockstar: Why not write a full answer? Nov 28, 2012 at 16:57
  • @Daniel: What are you tring to accomplish? This type of design probably isn't a good idea.
    – Jon Seigel
    Nov 28, 2012 at 18:06
  • 1
    Do you mean "store information about this specific file"? Or are you talking about writing data to the file itself?
    – mdoyle
    Nov 28, 2012 at 20:41
  • @Jon: This is exactly what I think as well. Might not be a good idea, but I have no idea how to do this in a different way. What I'm trying to do is to build up a WebDav server, where files will be stored by the user. Those files are supposed to be listed/presented on a website. The user should be able to search for those files, comment them, etc. Unfortunately... in the moment when those files will be "uploaded"/created on the server, they are getting random names like "ASD564A8A6S54EASEAS864.doc", so in this exact moment I don't even know the name of this file.
    – Daniel
    Nov 29, 2012 at 7:40

1 Answer 1

1

For a SQL Server solution, FILESTREAM (or FILETABLE if you can use SQL Server 2012) was built to solve this type of problem.

This solution will allow you to store the files in a central network location (most importantly, not on a web server box) outside the database, and manipulate metadata information within the database.

As mentioned in my comment, other RDBMS systems may also have similar capabilities (I'm not familiar enough with them to say, though).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.