Programming with FileStream Object By Sam Nasr, MCAD, MCT, MCTS Nasr Information Systems February 5, 2011
Agenda Housekeeping/Introduction Presentation Demo Evaluations
Housekeeping Cell Phones on vibrate please Bathrooms Forum for learning - Feel free to ask questions
Introduction Software developer since 1995 MCAD, MCT, MCTS(WSS/MOSS) Sam Nasr Independent Software Consultant Nasr Information Systems Software developer since 1995 MCAD, MCT, MCTS(WSS/MOSS) President - Cleveland C#/VB.Net User Group President – Cleveland WPF User Group INETA Mentor for Ohio INETA Community Champ
Audience Poll How many developers? How many DBA’s aspiring to be developers? .Net Expertise (Jr vs. Sr.) ?
System Requirements Supported Operating Systems: Windows Server 2003 Service Pack 2 Windows Server 2008 Windows Vista Windows XP Service Pack 2 For all download types: 32-bit systems: Intel compatible Pentium III 600 MHz (1 GHz recommended) 64-bit systems: 1 GHz CPU 512 MB of RAM (1 GB recommended) 675 MB of available hard disk space
Demo Environment Intel core Duo CPU 2.40 GHz 4GB RAM 500 GB HD Visual Studio 2010 Ultimate (64-bit) SQL Server 2008 Enterprise (64-bit) Windows 7 Ultimate (64-bit) / Windows Server 2008 Implemented using “Shrink volume…”
What’s the dilemma behind FileStream? How should large binary files be stored? Keep files in DB so everything is centralized and backed-up, but decrease DB performance? Store links to files in DB and risk files getting moved or deleted, but increase DB performance?
Enabling FileStream Machine level During installation SQL Server Config Mgr SQL Server Services | SQL Server (MSSQLSERVER)
Enabling FileStream Server Instance Server Properties | “Advanced” Stored Procedure EXEC sp_configure filestream_access_level, n RECONFIGURE n=0: disabled FileStream completely n=1: enabled for T-SQL access only n=2: enabled for full access (remote file streaming)
Streaming BLOBs OpenSqlFileStream - native client API GET_FILESTREAM_TRANSACTION_CONTEXT Returns a token that represents the current transaction context of a session. UNC Path Fabricated internal use NOT a real UNC path
Demo
Conclusion Let’s recap…
References Programming Microsoft SQL Server 2008 http://www.amazon.com/Programming-Microsoft-Server-2008-PRO-Developer/dp/0735625999/ref=sr_1_1?ie=UTF8&s=books&qid=1278000000&sr=8-1-spell FileStream in SQL Server 2008 http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2007/10/23/9886.aspx
Thank you for attending! Contact Info E-mail: sam@nasr.info Blog: http://ClevelandDotNet.blogspot.com Twitter: http://twitter.com/samnasr LinkedIN: http://www.linkedin.com/in/samsnasr SpeakerRate: http://speakerrate.com/samnasr Thank you for attending!