Microsoft SQL Remote Blob Storage (RBS) Samples

RBS is a library API set that is designed to move storage of BLOB data from database servers to external Content Addressable Stores (CAS). A reference to the blob is stored in the database. An application stores and accesses blob data by calling into the RBS client library. RBS manages the lifecycle of the blob e.g. doing garbage collection as and when needed.

The following samples are included:
  • Remote Blob Storage Sample Application Application.exe. This contains implementations of Simple Store / Fetch, Custom Store (specifying collections / blob stores), Store / Fetch using Push streaming, Store / Fetch using Pull streaming, and an example that uses the System.IO.Stream APIs to do asynchronous reads from the blob store.
  • File Store sample provider Microsoft.Data.BlobStores.FileBlobStore. This file contains the basic implementation of a provider that uses NTFS files as the blob store. This is a demonstration provider for development and testing purposes only and should not be used on production systems.
    • July 2010 update: When using the sample provider with SharePoint 2010, the account that is running the application pool for the web site needs to be added to the db_rbs_admin SQL Server Role in the blob database.
  • InstallProvider.exe utility application. This is a generic utility tool to aid in correctly installing, registering and uninstalling providers on both on the client and the server.
    • November 2009 update: To correctly install the sample provider or third party created provider, the provider dll will need to be registered in the GAC and either strong name signed or use sn.exe to provide a strong name signing override.
See the RBS team blog at http://blogs.msdn.com/sqlrbs for the latest news regarding RBS.

SQL Server 2008 R2 November CTP Feature Pack link
http://www.microsoft.com/downloads/details.aspx?familyid=020EE0D5-BCE4-4A45-9D64-B0C49C8831E5&displaylang=en

Also, the Remote Blob Store Provider Library Implementation Specification is now online at http://msdn.microsoft.com/en-us/library/cc905212.aspx.

Scenario

Jane is a developer for Adventure Works Cycles. She has to store documents in an external CAS store but still wants to utilize the relational capabilities of SQL Server without incurring the cost of manually keeping track of the external blobs.
Joe is a developer for a firm that manufactures Content Addressable Store hardware. He wants to create a provider library to allow applications that are RBS enabled to utilise his firm's technology.

Languages

Transact-SQL and Visual C#.

Prerequisites

Before running this sample, make sure the following software is installed:
  • Microsoft SQL Server or Microsoft SQL Server Express. You can obtain SQL Server Express free of charge from the SQL Server Express Documentation and Samples web site.
  • The SQL Server Remote Blob Store installation package available as part of the feature packs included with SQL Server, also available at the SQL Server Feature Pack site.
  • .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge.

Install File Store Provider from the provided binaries

To install the File Store Provider

At a command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the RBS sample directory. At the command prompt, run the following command:
notepad Binaries\InstallProvider.cmd

You can then edit the parameters in the command script for your setup. Each parameter should be documented in the command script. Once your custom configuration is complete, at the command prompt run the following command as an administrator:
Binaries\InstallProvider.cmd 

Execute the sample application

To run the sample application

To successfully run the sample application, a blob store provider must be installed. See the above section on installing the File Store Provider for instructions.
At a command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the RBS sample directory. At the command prompt, run the following command:
notepad Binaries\Application.exe.config


You can then edit the connection string named 'application' to connect to the SQL Server and Catalog that RBS is installed on. Once your custom configuration is complete, at the command prompt run the following command:
Binaries\Application.exe


Building the Samples

To build the Remote Blob Storage samples

Compile the sample by using Visual Studio 2008 and the provided Visual Studio solution, or by using Microsoft MSBuild, which is included in the .NET Framework SDK 2.0. Run commands similar to the following at a .NET Framework command prompt:
msbuild /nologo /verbosity:quiet /property:Configuration=Debug Source\RBS_Samples.sln 

Removing the installed File Store Provider

To remove the installed File Store Provider
At a command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the RBS sample directory. At the command prompt, run the following command:
notepad Binaries\UninstallProvider.cmd 

You can then edit the parameters in the command script for your setup. Each parameter should be documented in the command script. Once your custom configuration is complete, at the command prompt run the following command:
Binaries\UninstallProvider.cmd 

Comments

Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

© 2009 Microsoft Corporation. All rights reserved.

Last edited Jul 27, 2010 at 5:16 PM by mikew, version 15