Professional Web Applications Themes

Need Help with Locking - Coldfusion - Advanced Techniques

I need help with understanding about locking. I have my DSN created as Application Variable . I want to lock a transaction in one of the module to is used for update. I don't want users to get affected when browsing the data using the other modules. Thanks...

  1. #1

    Default Need Help with Locking

    I need help with understanding about locking. I have my DSN created as
    Application Variable . I want to lock a transaction in one of the module to is
    used for update. I don't want users to get affected when browsing the data
    using the other modules.

    Thanks

    CFRAM Guest

  2. #2

    Default Re: Need Help with Locking

    Here are some references you may find useful.
    [url]http://richmond-cfug.btgi.net/CFLOCK.PDF[/url]
    [url]http://www.webtricks.com/sourcecode/code.cfm?CodeID=25[/url]

    [url]http://livedocs.macromedia.com/coldfusion/5.0/Developing_ColdFusion_Applications[/url]
    /appFramework.htm


    jdeline Guest

  3. #3

    Default Re: Need Help with Locking

    Still I not clear by reading the articles. Does CFLOCK OR CFTRANSACTION work the same way as database row lock in Oracle.
    CFRAM Guest

  4. #4

    Default Re: Need Help with Locking

    Still I am not clear by reading the articles. Does CFLOCK OR CFTRANSACTION work the same way as database row lock in Oracle.
    CFRAM Guest

  5. #5

    Default Re: Need Help with Locking

    They work nothing like a row lock. CFLOCK allows thread-safe access to
    shared-memory variables, or (using a named lock) exclusive access to a code
    block for one user... the latter of which you had better be REAL sure about
    before utilizing.

    CFTRANSACTION provides rollback capability in case a database operation (or
    one of multiple operations encapsulated by a single cftransaction block) fails.

    If i understand your post correctly, you want to ensure a single user has
    access to a particular code block? If so, CFLOCK it with a named lock. i.e.

    <cflock name="STRANGLER" timeout="3">
    <cf_getThisOverWithQuick>
    </cflock>

    In the above, when one user invokes the lock named STRANGLER no one else can
    invoke it (or run the code within) until that code is done and the lock is thus
    released.

    Generally this is something you never want to do in a web application.
    'never' is perhaps too strong but not by much. Depending on your context
    cf_LockMonger might be what you are after instead:

    [url]http://mysecretbase.com/lockmonger.cfm[/url]

    It will keep you from choking your web application to death ;-)

    HtH,

    --Matt--
    MSB Web Systems... [url]http://mysecretbase.com[/url]
    The trouble with most jobs is the job holder's resemblence to
    being one of a sled dog team. No one gets a change of scenery
    except the lead dog.
    - Moer's truism


    MattRobertson Guest

  6. #6

    Default Re: Need Help with Locking

    >... I need help with understanding about locking.
    >... I have my DSN created as Application Variable
    If the code <cfset Application.myDSN = "RealDatabaseDSNname"> appears
    just once in your application, usually in Application.cfm or Application.cfc,
    then
    it is safe to use Application.myDSN everywhere, without the need for a lock.


    BKBK Guest

  7. #7

    Default Re: Need Help with Locking

    Thanks Guys. That was really helpfull.
    CFRAM Guest

Similar Threads

  1. Page Locking Up
    By llf0652 in forum Macromedia Contribute General Discussion
    Replies: 5
    Last Post: February 16th, 07:17 PM
  2. Locking Objects
    By Rick Waugh in forum Coldfusion - Advanced Techniques
    Replies: 1
    Last Post: May 25th, 08:11 PM
  3. File locking for all my needs
    By Matija Papec in forum PERL Miscellaneous
    Replies: 0
    Last Post: September 9th, 09:38 PM
  4. DB2 locking UDF dll
    By W Gemini in forum IBM DB2
    Replies: 2
    Last Post: August 7th, 03:23 AM
  5. Pessimistic locking
    By Ian Smith in forum Microsoft Access
    Replies: 0
    Last Post: July 23rd, 05:09 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139