<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx</link><description>As mentioned in my previous blog , SqlDependency is a new feature in .Net framework 2.0, which provide a mechanism to notify an app when a cache is invalidated. We got enough feedback from customers in Beta 2 with regards ease of deployment (some issues</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#474725</link><pubDate>Wed, 28 Sep 2005 07:18:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474725</guid><dc:creator>Ken</dc:creator><description>Nice post. I have two questions: Can I use SQL Server 2000 for using this feature? We are developing a windows client application with about 1000 users using it concurrently. Can we set up change tracking from each of the result queried from the client? Hopw well does it scale?</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#474877</link><pubDate>Wed, 28 Sep 2005 17:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474877</guid><dc:creator>Anonymous</dc:creator><description>I downloaded the September CTP and got it working. This post helped in understanding the invalidation functionality. What happens when to the connection that is opened for listening,if I dont close it? What happens to the queue/service/sp created in that case?</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#474928</link><pubDate>Wed, 28 Sep 2005 19:49:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474928</guid><dc:creator>sushilc</dc:creator><description>Ken, This feature is not supported on SQL Server 2000, as it works on top of Queue mechanism that is new for 2005. SqlDepenedncy should ideally be used for mid-tier scenarios. The problem with having 1000 concurrent dependenciers is:&lt;br&gt;1. Opening of 1000 connections from different client - this should cause resource issues on the server&lt;br&gt;2. Each connection will then open 1000 queue/services/procs on the server. This can be alleviated by providing custom queues&lt;br&gt;3. Each notification request on the server will consume resources on the server&lt;br&gt;&lt;br&gt;I would recommend against developing dependency apps at the client tier. It would make more sense to have your cache on the middle tier and then use SqlDependency for notifying on changes.&lt;br&gt;&lt;br&gt;Hope this helps,&lt;br&gt;Sushil</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#474934</link><pubDate>Wed, 28 Sep 2005 19:56:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:474934</guid><dc:creator>sushilc</dc:creator><description>Anonymous, the connection that is called with Start is left open if you dont call the corresponding Stop.The transient resources created on the server are still alive till the connection is open. When the AppDomain gets unloaded, the connection gets closed and all the transient resources are also removed. If the application is rudely aborted (meaning the AppDomain.Unload event is not called) then the server side clean up has to kick in. The Stored proc (After a specific timeout) on the server checks if there is a connection open that is listening to the transient queue. If it doesnt find such a connection , then it drops the queue/service and itself.&lt;br&gt;&lt;br&gt;Hope this helps.&lt;br&gt;Sushil</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#476568</link><pubDate>Mon, 03 Oct 2005 23:38:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:476568</guid><dc:creator>Sunish Abraham</dc:creator><description>I used the code above to &amp;quot;watch&amp;quot; the Products table in the AdventureWorks database and the OnChange was called once but after that it wouldn't display modifications to the table ; I was using the following SQL (SELECT ProductID, [Name] AS ProductName FROM Production.Product) ; do you have do something to &amp;quot;re-enable&amp;quot; the SqlCacheDependency?</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#478904</link><pubDate>Sun, 09 Oct 2005 22:49:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:478904</guid><dc:creator>Julie Lerman</dc:creator><description>Sunish&lt;br&gt;the SqlDependency has a one to one relationship with the command. You will only get one notification returned. When you refresh your data, you need to register a new SqlDependency to get an additional notification - so that happens each time.</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#479377</link><pubDate>Tue, 11 Oct 2005 02:10:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:479377</guid><dc:creator>Johan Danforth</dc:creator><description>Sushil, great blog - just found it and will note my buddies. &lt;br&gt;&lt;br&gt;I was wondering about the underlying architecture for notifications and problems with firewalls. It seems that the architecture changed from server push to client pulls, right?&lt;br&gt;&lt;br&gt;Also, if the client is controlling the dependency connection, what happens if the connection is dropped due to network probs or something? Exception in the client, or does the provider framework handle it and tries to establish the connection again?&lt;br&gt;&lt;br&gt;Finally, how is performance. How often does the client go ahead and pull stuff from the server and how on earth does the server keep up with the load that can build up, even if you use a middle tier design?&lt;br&gt;&lt;br&gt;Keep up the good work!&lt;br&gt;&lt;br&gt;/JOhan</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#480280</link><pubDate>Thu, 13 Oct 2005 00:26:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:480280</guid><dc:creator>DataWorksBlog</dc:creator><description>Johan, These are some very good questions. Answer follows:&lt;br&gt;&lt;br&gt;-Yes, the architecture has changed from Server push to Client pulls. Since we open connections under the hood to monitor notifications, the firewall configuration would be no different from configuring a normal DataAccess application&lt;br&gt;&lt;br&gt;-If connection that listens for notifications fails, on first failure, we release commands and connections, and immediately attempt to re-connect.If retry also fails, then we invalidate all pending SqlDependency objects, wait 1 minute and try again.&lt;br&gt;&lt;br&gt;-Performance: The client pulls notification from the server only when they are available else nothing happens from the client pespective. From the server perspective, it uses SQL Server Service Broker(/SSB) technology which is new for SQL Server 9.0. The whole notification mechanism is based on Asynchronous, queued messaging. More information on how SSB works can be found at &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/sqlsvcbroker.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/sqlsvcbroker.asp&lt;/a&gt;&lt;br&gt;&lt;br&gt;Hope that helps,&lt;br&gt;Sushil Chordia&lt;br&gt;ADO.Net&lt;br&gt;&lt;br&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#482336</link><pubDate>Tue, 18 Oct 2005 21:23:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:482336</guid><dc:creator>Mark Nischalke</dc:creator><description>The required database permissions section was just what I was looking for, thank you. I'm confused though as to why it appears that the sysadmin role does not seem to have the required permissions. &lt;br&gt;&lt;br&gt;I have an application that uses a sqldependency to monitor a table and uses intergrated security=sspi in the connection string. If I run the app as a system admin it won't work, unless connected to the network. Changing the connection string to use sa won't work either, unless connected to the network. If I create a user and add the permissions mentioned everything works fine, connected or disconnected from the LAN.&lt;br&gt;&lt;br&gt;Database and app are on one laptop btw.</description></item><item><title>DataType of SqlDependency.Id</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#486997</link><pubDate>Sun, 30 Oct 2005 18:06:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:486997</guid><dc:creator>Michael Vanhoutte</dc:creator><description>In Beta 2, SqlDependency.Id contained a string representation of a Guid. At that time I already wondered why this wasn't simply a Guid instead of a string, but I didn't spend much time on it.&lt;br&gt;Today when I tried to run my code after compiling it with the RTM build I noticed that it fails because SqlDependency.Id now contains a semi-colon separated list of Guids:&lt;br&gt;ceaf3eb4-0d63-492f-b433-c13482ab21c8;d7d6445d-03b8-4c5c-82cc-95a230a0690a&lt;br&gt;&lt;br&gt;I was wondering what the idea and purpose behind this is?</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#502324</link><pubDate>Sat, 10 Dec 2005 09:01:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:502324</guid><dc:creator>davidw</dc:creator><description>I have tried the SqlDependency for a while. In RTM version, it finally works for me. It only works for a period of time, then I have to restart my IIS. So it doesn't look like it is the Sql side problem. But I have no idea how to debug on client side, maybe you can tell me a way to do some debug on client side.</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#505344</link><pubDate>Mon, 19 Dec 2005 07:05:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:505344</guid><dc:creator>Robert Zurer</dc:creator><description>I haven't been able to get SqlDependency to work at all with CLR procedures. Is it supposed to?</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#506999</link><pubDate>Fri, 23 Dec 2005 10:31:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:506999</guid><dc:creator>Adidas</dc:creator><description>http://www.shoes-warehouse.net/list.html</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#507168</link><pubDate>Sat, 24 Dec 2005 02:07:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:507168</guid><dc:creator>Paul Reid</dc:creator><description>Like davidw, I also get it to work for about 10 minutes or so in IIS and then it fails from then on.  If I restart IIS, it is fixed for about another 10 minutes or so.&lt;br&gt;&lt;br&gt;Looks like SqlDependency is not ready for prime time...</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#507395</link><pubDate>Mon, 26 Dec 2005 18:02:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:507395</guid><dc:creator>Julie Lerman</dc:creator><description>RobertZ-&lt;br&gt;In &amp;quot;Creating Query Notification Subscriptions&amp;quot; in the docs there is a note that says &amp;quot;Transact-SQL does not provide a way to subscribe to notifications. The CLR data access classes hosted withing SQL Server do not support query notifications.&amp;quot;&lt;br&gt;&lt;br&gt;Hope that helps...</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#518230</link><pubDate>Fri, 27 Jan 2006 11:24:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:518230</guid><dc:creator>Eric</dc:creator><description>Is it possible to use SqlDependency with SQL Server Express User Instances? In that case how do you enable the broker? My ALTER DATABASE statement always fails.&lt;br&gt;&lt;br&gt;Thanks for a good post, Eric</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#518488</link><pubDate>Fri, 27 Jan 2006 22:57:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:518488</guid><dc:creator>Chris</dc:creator><description>I have executed the above TSQL for my new user on the database that contains the data, but I am still getting an error.&lt;br&gt;&lt;br&gt;&amp;quot;System.Data.SqlClient.SqlException: The specified schema name &amp;quot;dbo&amp;quot; either does not exist or you do not have permission to use it.&amp;quot;&lt;br&gt;&lt;br&gt;I am missing something simple, but I am not sure what it is.&lt;br&gt;&lt;br&gt;I did not give the user any special permissions except for the ones stated above and permission to use the database with the default schema set to dbo.&lt;br&gt;&lt;br&gt;Note that SqlDependency.Start() works fine when I give the user sysadmin rights.  &lt;br&gt;&lt;br&gt;Any help would be greatly appreciated.&lt;br&gt;Chris</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#526212</link><pubDate>Tue, 07 Feb 2006 04:38:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:526212</guid><dc:creator>DataWorksBlog</dc:creator><description>Hi Chris, this is becase we are missing one more permission in the blog. The TSQL in blog was written with the assumption that the logins have alter permission to the dbo schema.&lt;br /&gt;&lt;br /&gt;In order to create a procedure (or a function or a table or … any other schema-scoped object), you need at least ALTER permission on the target schema. Here is the TSQL syntax, hope this helps:&lt;br /&gt;&lt;br /&gt;grant alter on schema :: some_schema to &amp;nbsp;least_privileged_user &lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;Sushil Chordia&lt;br /&gt;&lt;br /&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#528258</link><pubDate>Thu, 09 Feb 2006 07:28:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:528258</guid><dc:creator>Vishant</dc:creator><description>Is there anyway to find out which row is affected in OnChange event? Or which data has been modified?</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#533366</link><pubDate>Thu, 16 Feb 2006 20:06:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:533366</guid><dc:creator>DaveH</dc:creator><description>Hi Sushil,&lt;br&gt;&lt;br&gt;Firstly nice article.&lt;br&gt;&lt;br&gt;I have taken you code above and gotten a very simple select id, name from dbo.users and everything works fine, once the &amp;nbsp;dep.OnChange is called I set it up again to get constant updates, this all works great.&lt;br&gt;&lt;br&gt;Although as soon I try to perform a simple join I get the delegate being called multiple times (untill i stop the app) and args.info is Invalid?&lt;br&gt;&lt;br&gt;Am I missing something or do you have any ideas?&lt;br&gt;&lt;br&gt;Thanks a lot,&lt;br&gt;&lt;br&gt;D&lt;br&gt;&lt;br&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#541291</link><pubDate>Wed, 01 Mar 2006 18:23:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:541291</guid><dc:creator>flanger</dc:creator><description>This page is the bible (currently) for implementing SqlDependency - thanks! However, I haven't seen any examples about running this in the Application_Start event of Global.asax.cs, which would seem the obvious place to set up caching static tables in the Application cache.&lt;br&gt;For the .NET 2.0 example below I have not been able to get a table change to fire the delegate anon method (which I want to null out the cache for testing). I see that the Queue and Service are being created in SQL 2005, but never firing to this client when I modify the table. &amp;nbsp;I have been very careful to setup all of the SQL permissions as you've defined above. &amp;nbsp;Should I be looking to SQL2005 or the Application_Start method to figure out why this isn't working?:&lt;br&gt;		protected void Application_Start(Object sender, EventArgs e)&lt;br&gt;		{&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (SqlConnection conn = SqlHelper.GetSqlConnection(SqlHelper.enUser.WTJournal, SqlHelper.enDataBase.EnterpriseDB))&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;using (SqlCommand cmd = new SqlCommand(&amp;quot;SELECT MARKET_ID, DESCRIPTION FROM dbo.MARKETS&amp;quot;,conn))&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// create dependency associated with cmd&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlDependency depend = new SqlDependency(cmd); &lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlDependency.Start(conn.ConnectionString);&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// register handler&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;depend.OnChange += delegate(Object o, SqlNotificationEventArgs args)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Application[&amp;quot;MARKETS&amp;quot;] = null; &amp;nbsp;&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;};&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// .. load up the dataset ds here&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Application[&amp;quot;MARKETS&amp;quot;] = ds;&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (Exception ex)&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ Console.WriteLine(ex.Message); }&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;br&gt;&lt;br&gt;Thanks for any insight,&lt;br&gt;flanger</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#541458</link><pubDate>Wed, 01 Mar 2006 22:22:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:541458</guid><dc:creator>DataWorksBlog</dc:creator><description>Hi flanger, Thanks for your comments above. &lt;br&gt;As per the above code snippet, you set up SqlDependency on variable &amp;quot;cmd&amp;quot;; but you dont execute it at all. Query subscriptions on the server happen only on command execution. You should use the command set up with SqlDependency to fill your dataset and then use it.&lt;br&gt;&lt;br&gt;Hope this helps,&lt;br&gt;Sushil Chordia</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#545205</link><pubDate>Tue, 07 Mar 2006 14:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:545205</guid><dc:creator>FvS</dc:creator><description>Hi,&lt;br&gt;&lt;br&gt;first I have to agree that this is a great reference for using SqlDependency.&lt;br&gt;&lt;br&gt;Can you tell me if there's a System SP or something to tell the SSB to process all current events?&lt;br&gt;Because when I do an update or insert on a table and then right away call a select(with an SqlDep assigned) on that table the SqlDep.OnChange fires right away for the previous update/insert.&lt;br&gt;I guess that's because the SSB is asynchronous and does take some time to process these events - when I put a Thread.Sleep(1000) between the update and the select it works just right, but I'm not quite happy with that solution...&lt;br&gt;&lt;br&gt;Thanks&lt;br&gt;&lt;br&gt;Florian&lt;br&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#568386</link><pubDate>Tue, 04 Apr 2006 22:27:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:568386</guid><dc:creator>Kevin</dc:creator><description>I also agree with the post’s above. &amp;nbsp;This is the best one-stop shop of information regarding using SqlDependency I’ve found so far. &amp;nbsp;However, I’m having some problems… &amp;nbsp;&lt;br&gt;&lt;br&gt;My multi-tiered application (SQLServer 2005/.NET 2.0) makes use of several different query notifications. &amp;nbsp;All data related calls are made from the data-access tier. &amp;nbsp;Calling SqlDependency.Start works just fine on some calls and the related notifications are delivered without problem. However, following the same pattern, other calls to SqlDependency.Start result in a System.Runtime.Serialization.SerializationException with the message &amp;quot;Unable to find assembly...&amp;quot;. &amp;nbsp;The assembly that is mentioned is actually upstream from the data-tier and should have no ties whatsoever to the database, only to the data-tier. &amp;nbsp;Can you help me understand what is happening here? &amp;nbsp;Any way to work around this?&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Kevin&lt;br&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#570917</link><pubDate>Fri, 07 Apr 2006 19:36:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:570917</guid><dc:creator>Ruth Cook</dc:creator><description>I have two questions:&lt;br&gt;&lt;br&gt; - how resource and time heavy is setting up an individual dependency&lt;br&gt;&lt;br&gt; - Is it necessary to create a new SqlConnection, SqlCommand, SqlDependency object each and every time, as shown in flanger's post?&lt;br&gt;&lt;br&gt;I'm trying to use a dependency to monitor a table that could be written (a few) times a second, from one (possibly a few) clients. I'm hoping this isn't going to cause a problem...&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;&lt;br&gt;Ruth</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#582675</link><pubDate>Tue, 25 Apr 2006 07:45:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:582675</guid><dc:creator>staceyw</dc:creator><description>Excellent article. &amp;nbsp;The new pull model makes so much more sence. &amp;nbsp;I did something similar with tcp sockets where socket was put in a list and a new insert invoked a timer. &amp;nbsp;So the user would get a Notify message after N new records or after time expire (which ever comes first) so you can &amp;quot;batch&amp;quot; messages and not send notify after every new record, which can bog the server if you don't need to see every new record right away. &amp;nbsp;Now with this feature, I don't need to roll that myself. &amp;nbsp;I do loose the ability to batch, so that may be a nice feature to add at some point. &amp;nbsp;Also, if you did it yourself for 1000 users, you would still need 1000 sockets, so the tax for sqldependancy on the server is not a net increase. &amp;nbsp;The new dynamic queues for each user is tax.&lt;br&gt;&lt;br&gt;Maybe you could just &amp;quot;name&amp;quot; the queue in the constructor, and it creates it once on first use for all &amp;quot;N&amp;quot; clients and deletes it after some period of no client activity. That would save new queue overhead, and keep it easy on the client side with no need to know about server side queues - other then the name. </description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#583164</link><pubDate>Tue, 25 Apr 2006 18:25:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:583164</guid><dc:creator>DataWorksBlog</dc:creator><description>Stacey, Thanks for your comments. Yep, I agree that having a new Queue created for 1000 users is a tax. The idea of custom queues that you proposes is already part of v2.0. For case as such, you can always use custom queues. Use SqlDependency.Start(ConString,QueueName) to start a listener to a queue and a service already created. Once you start the SqlDependency with the queue name. You will have to create othe SqlDependency objects by specifying these custom service. Let me know if you have questions.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Sushil.&lt;br&gt;&lt;br&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#621624</link><pubDate>Thu, 08 Jun 2006 09:18:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:621624</guid><dc:creator>Boaz</dc:creator><description>Hi Sushil,&lt;br&gt;&lt;br&gt;I have been testing SQLDependency and I have a few questions;&lt;br&gt;&lt;br&gt;1) When using a stored procedure to run the dependency query, using a &amp;quot;clean&amp;quot; procedure (containing nothing but a select statement), works fine. Adding try..catch (which is a part of our coding standards), results in the subscription firing immediately because of an invalid query. Is this by design? If so, how can I implement error handling.&lt;br&gt;&lt;br&gt;2) How does SQLDependency handle SQL Server restarts? &lt;br&gt;I see two options:&lt;br&gt;a) The subscription is fired listing a server restart message in the service broker queue, but as far as I can tell, SQLDependency has no way of handling these messages given the connection has been broken. (Establishing a new connection and dependency won’t read the said messages).&lt;br&gt;b) The SQLDependency listener on the client raises an error for the connection being terminated. Can I relay on this event to recreate a connection and dependency?&lt;br&gt;&lt;br&gt;TXN in advance&lt;br&gt;&lt;br&gt;Boaz&lt;br&gt;</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#629284</link><pubDate>Tue, 13 Jun 2006 12:16:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:629284</guid><dc:creator>Sutikshan</dc:creator><description>Hi Sushil,&lt;br&gt;Could you please suggest me on following:&lt;br&gt;If I have around 70-80 clients having my Winform Application running, and there is only one SQL Server being shared by all the client. How should I implement the SQL Server Notification Services:&lt;br&gt;-Will it raise the performance issue on server, if I use SQLDependency Object.&lt;br&gt;-What are the other ways to design Notification Services solution from better performance perspective, if the target is to solve the stale cache problem only.&lt;br&gt;&lt;br&gt;Thanks in Advance!&lt;br&gt;Sutikshan Dubey&lt;br&gt;</description></item><item><title>SqlDependency</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#648551</link><pubDate>Tue, 27 Jun 2006 18:08:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:648551</guid><dc:creator>Dan Miser</dc:creator><description /></item><item><title>re:SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#650503</link><pubDate>Thu, 29 Jun 2006 09:16:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:650503</guid><dc:creator>Tejas Patel</dc:creator><description>Hi Sushil&lt;br&gt; &amp;nbsp; I face one problem but i don't know is it problem or not.&lt;br&gt; &amp;nbsp; I create SqlDependency Object using following code.In my dbo.Users table there are two columns.one is Id and other is Name&lt;br&gt;Now if i change in Name column value its call OnChangeEventHandler.&lt;br&gt; &amp;nbsp; I think it is wrong because in Sqlcommand &amp;nbsp;query I write only one column ID so I think its only call on changes of ID column value&lt;br&gt;SqlCommand oCommand = new SqlCommand(&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;quot;SELECT ID FROM dbo.Users&amp;quot;,&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oConnection);&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlDependency oDependency = new SqlDependency(oCommand);&lt;br&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;oDependency.OnChange += new OnChangeEventHandler(OnNotificationChange);&lt;br&gt; &lt;br&gt; Give me answer it is write?&lt;br&gt; I just want to Notifaction on ID column </description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#655485</link><pubDate>Mon, 03 Jul 2006 22:59:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:655485</guid><dc:creator>Sushil Chordia</dc:creator><description>Sutikshan, When you have 70-80 clients connecting to the server you have following options:&lt;br&gt;1. Create a mid-tier that process the requests from the client. The Cache on the mid-tier is queried from the backend server and change tracking enabled using one default implementation of SQLDependency.&lt;br&gt;&lt;br&gt;2. If the above is not an option, then at the very minimum create a custom queue and a service on the Server and have all the client listen to this Queue to track for change notification. This will remove the overhead of creating unnecessary objects on the store. There will still be some overhead on the server because of ~80 different client continously polling for a notification message sent on the queue.&lt;br&gt;&lt;br&gt;hope this helps,&lt;br&gt;Sushil.</description></item><item><title>re: SqlDependency changes for RTM [Sushil Chordia]</title><link>http://blogs.msdn.com/dataaccess/archive/2005/09/27/474447.aspx#655488</link><pubDate>Mon, 03 Jul 2006 23:04:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:655488</guid><dc:creator>Sushil Chordia</dc:creator><description>Hi Boaz, Thanks for visiting this blog. Here are answers to your question.&lt;br&gt;1. As per Torsten Garbs &amp;quot;Unfortunately, the behavior for TRY/CATCH and SqlDependency is by design. Please check a recent MSDN Forum discussion on this topic. You can find it at:&lt;br&gt;&lt;a rel="nofollow" target="_new" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=464435&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=464435&amp;amp;SiteID=1&lt;/a&gt; &amp;quot;&lt;br&gt;2. When the Server is down, the underlying connection that polls for Notification on the queue, tries to reconnect to the server:&lt;br&gt;a. &amp;nbsp; &amp;nbsp; If the server responds to the second re-connect, then the SBS (Broker Service) has the Restart notification message on its queue and &lt;br&gt;the SqlClient should just raise this event.&lt;br&gt;b. &amp;nbsp; &amp;nbsp; If the server doesn't respond to the re-connect, then the client throws a notification of the form {SqlNotificationType.Change, SqlNotificationInfo.Error, SqlNotificationSource.Client}.&lt;br&gt;</description></item></channel></rss>