Multiple access

What is the best way of handling multiple accesses to a table? I'm using C and the dbxxx (dbinit, dbopen, etc.)functions. I don't know how MS SQL deals with this. If two processes come in at the same time (or nearly so), does one get kicked out? Is there some sort of programmatic loop I can do on one of the dbxxx functions to keep trying rather than just failing?
flfmdllAsked:
Who is Participating?
 
clarkdConnect With a Mentor Commented:
ms sql server will handle the situation for you.  when two processes attempt to access the table sql server will first decide what process attempted to  access the table first.  if it can do so then sql server will give access to the first process and decide, based upon the type of process, wether or not the table can also be acessed by the second process or if it will need to stand in line and wait for the first process to end.
if sql server cannot determine wich process requested access to the table, sql will randomly select which process gets first access.

0
 
flfmdllAuthor Commented:
So it will not dump one process (return to the program with an error) and let the other process go through? So I don't have to do anything programmaticaly with MS SQL?

0
 
Victor SpiridonovCommented:
Your secon process will either be 'queued' or allowed access: depend on the lock type used by the first process.
0
 
flfmdllAuthor Commented:
Thanks. I'll try this and see how it works.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.