Ensure Concurrency in database application
+ Reply to Thread
Results 1 to 3 of 3

Thread: Ensure Concurrency in database application

  1. #1
    Join Date
    Sep 2004
    Location
    Chennai
    Posts
    1,489

    Default Ensure Concurrency in database application

    Hi,


    I'm back again to this section.

    I'm doing a simple website(hosted on LAN - one server, 5 or 6 systems connected to it). It has a form which accepts details of a new user, and then saves these details to a mysql database. I want to assign each new user a unique ID, starting from say, 1000. I want to assign the IDs sequentially for each user.

    I plan to find the MAX of the user-id column each time a form is submitted, and return the next higher value. All the 6 computers connected to the server may submit the registration form at the same time. Should I ensure that no two users are given the same ID?? Or will it work out correctly?



    Thanks!
    I Will Be Back!!!

  2. #2
    Join Date
    Feb 2005
    Location
    Madras
    Posts
    12,123

    Default

    All the 6 computers connected to the server may submit the registration form at the same time. Should I ensure that no two users are given the same ID?
    Yes you should in a multiuser environment. I was told you should use threads for such a situation. I havent tried out. But I think each database connection is a thread. Based on the thread priority, you can arbiter which one gets to insert first This was for ASP.NET, but donno what you are using there.

    Morover if the uid is a primary key/unique key of the table. would it generate a duplicate identity value at the first place
    I know I know I know I know I know I know I know

  3. #3
    Join Date
    Sep 2004
    Location
    Chennai
    Posts
    1,489

    Default

    Morover if the uid is a primary key/unique key of the table. would it generate a duplicate identity value at the first place
    yes, i guess there will be an error...
    Haven't started doing it, but thought this isue may arise...

    asp illai, i'm using php. And mysql.
    I Will Be Back!!!

+ Reply to Thread

Similar Threads

  1. Please ensure you're eating something yummy before you click this
    By coolian in forum Gossip / Interesting Talk
    Replies: 0
    Last Post: 11-14-2007, 07:13 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