Sql-server – Mapping a shared physical folder to filestream

filestreamsql serversql-server-2012

We are working on a project where we have large amounts of images, texts etc which we need to work on in SQL Server. We were thinking of using Filestream and filetable functionality. However, even after trawling through a lot of data on the net, we aren't able to find answers to the below queries:

  1. We are trying to create a shared folder on our system and then map it to the filestream. So we are creating a shared folder (lets say D:\Ftable ) which has access level set to full access for everyone. Now when we go to the SQL Server configuration manager and try to set this folder as shared folder for filstream (the properties tab where we enable the filestream access) it throws us error : The windows share folder name is not a valid windows share. We know that filestream folder has to be a local folder, however even when we just try to put a different local folder path (like D:\test etc) it gives us an error.

  2. We would also like to know if it is possible to create a filestream shared directory on a mapped drive? We have created a shared folder on one system and mapped that folder on a different system (so that it appears as local). However once again, when we try to set a specific folder on the mapped drive as filestream shared folder, it throws us an error.

Would really appreciate any pointers/help on the topic. Our main access is to create a filestream share on a physical location of our choice which is shared so that we can transfer data to it either remotely/ or via a tool.

Best Answer

this isn't exactly how filestream and filetables work, you can't specify the name of an existing share as SQL server will try and create the share that you specify in SQL Server Configuration Manager. This is because the share is not mapped directly to a folder on the filesystem like a normal share, but an NTFS data container that lives in the filestream filegroup that is created for the database.

There is a misconception with filestream/filetable that because the data is stored in the filesystem, it is just a normal folder, this isn't entirely correct.

When you create your database, you specify that one of the filegroups is a filestream filegroup, this isn't like a normal filegroup and is actually a series of NTFS folders called Data Containers, this is where your files actually get stored, you can't modify this folder directly, but you can look at the contents (not that there's much human readable stuff in here though, you can find your actual files in here though if you look hard enough through the GUID folders and oddly named files :)).

The file share that you use to copy the files into the table is actually a representation of the data inside these data containers that is presented to Windows explorer via a filter driver which uses the streaming APIs to make the changes to the data containers and add the rows to the filetable etc.

So if you want to specify the location that the files are physically stored, you need to specify that location as where you want the filestream filegroup stored, then you can change the share name to whatever you want.