Take the 2-minute tour ×

I am using SQL Server 2008.

I have a table (TBL_FILE) that stores user uploaded files in binary column. However users do not want to open our system to access the file. They want to have a folder (network drive, Web folder, local drive, local folder... are accepted) that maps to the table (TBL_FILE). So they can directly open the file directly in File Explorer.

The key point is they want to open files directly in File Explorer.

Is it possible to do that? And what kind of program I need to write to do that? And how to do security?



share|improve this question
add comment

2 Answers

Have you considered writing an application that would prompt for a login, then present a list of files to the user in a friendly user interface? You could drop a shortcut to that application in the folder they want these files to live in.

If you must have shortcuts directly from the filesystem into your binary data fields, then you are going to have to be a little bit hacky. Depending on how often the files are updated, you can try one of these options:

1 - Write an application that will run as a Windows Service or as a scheduled job. Periodically check for changed binary data, and save it to disk. Disadvantage: the file system will only be updated at intervals, so database changes will not be immediately available.

2 - Write a trigger on the table that saves the binary file to disk. Fire the trigger whenever the row changes- preferably by monitoring a 'last modified time' or similar field, rather than checking the binary value directly. The trigger could fire a CLR stored procedure, or you can do it directly from T-SQL using the method described here. Disadvantage: You have a potentially time-consuming trigger on the table.

In either case, security becomes the problem of the Windows filesystem. Just grant access to the folder to whomever should see the files.

Good luck!

share|improve this answer
Thank you for your reply. I understand your points. My old solution is performing data sync between database and file system. Create a file change listener on file system. Once there is a change on file system, the listener updates the record in database. Moreover, create a trigger to update file from database to file system. However they are both slow. I am looking for new solution to handle this problem. So the best (maybe over-ideal) way is map a folder to DB table. Thanks –  Alex Yeung Apr 15 '11 at 1:14
add comment
up vote -1 down vote accepted

after searching in google, I finally find a solution of this problem.

We could create a logical drive with .NET technology or other third party libraries. One of the libraries is Doken http://dokan-dev.net/en/.

Doken is able to let us to create a drive in computer and do the logic ourselves. It seems that it is able to map a folder to a table in Database. But I haven't tried it yet.



share|improve this answer
Dokan's great feature is it's free open-source license. Unfortunately that's the only positive feature of Dokan. –  Eugene Mayevski 'EldoS Corp Apr 21 '11 at 16:11
add comment

Your Answer


