CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2001
    Location
    Karachi
    Posts
    91

    Technical advice needed regarding polling the database

    I have a database which is very frequently updated .I want an option that user can specify that after how many minutes he/she wants to see those changes . Like a mechanism which would do

    1. Poll database after a user defined period and then bring those changes ,mean while displaying the stale data (like Cache )
    2. Also allow user to choose if he/she wants to see/notify updates as they come
    3. Can notify change ( if any ) in a particular table occur

    I have read a lot about SQLDependency class which is used to data caching .The reason I am confused is

    1. The recommendations are that don’t use this feature if your data is frequently updating (in my case data is frequently updating)
    2. The class does Cache data for me but I cant find any mechanism which would notify me that a change has occurred and how many row in a particular table are added.

    I am confused .What feature I should used . Should SQLDependency class can do the things I want or these can be done without SQLDependency Cache feature .

    Please advice.
    Faults are thick where love is thin

  2. #2
    Join Date
    Feb 2001
    Location
    Sydney, Australia
    Posts
    1,909

    Re: Technical advice needed regarding polling the database

    I think we could all use little more information of the system you're developing before giving out any advices.

    But even now I have something to say:

    *That you call "giving user a option to specify poll frequency" I call "shift the burden to the user" because normally users don't think in terms of "database update" and it's not user friendly after all.

    *The reason why MS doesn't not recommend using SQLDependency on frequently updated data - is performance. Magic comes with a high price - every time you create SQLDependency object MSSQL Server 2005 creates a queue and notification service in database.

    Post more information about design and architecture of your project,
    about static structure of database, how data is changed/added, etc and
    we'll start it from there.


    Quote Originally Posted by forkirun
    I have a database which is very frequently updated .I want an option that user can specify that after how many minutes he/she wants to see those changes . Like a mechanism which would do

    1. Poll database after a user defined period and then bring those changes ,mean while displaying the stale data (like Cache )
    2. Also allow user to choose if he/she wants to see/notify updates as they come
    3. Can notify change ( if any ) in a particular table occur

    I have read a lot about SQLDependency class which is used to data caching .The reason I am confused is

    1. The recommendations are that don’t use this feature if your data is frequently updating (in my case data is frequently updating)
    2. The class does Cache data for me but I cant find any mechanism which would notify me that a change has occurred and how many row in a particular table are added.

    I am confused .What feature I should used . Should SQLDependency class can do the things I want or these can be done without SQLDependency Cache feature .

    Please advice.
    Best regards,
    Igor Sukhov

    www.sukhov.net

  3. #3
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Technical advice needed regarding polling the database

    If you are using SQL-2005, then consider using the event model instead of polling.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured