Home > Archive > MS SQL Server ODBC > April 2006 > SQLS 2000 Record Locking Problems (VC++)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SQLS 2000 Record Locking Problems (VC++)
Arnie

2006-04-07, 8:23 pm

Sorry for the wordiness.

VC++ 8.0, XP Pro SP2, etc. We're porting from Borland C++
Builder/ADO to VC++/ODBC. This worked fine with BCB/ADO.

First, the rationale. We have a number of 'batch' (console) apps
that can not be run at the same time due to possible conflicts in
DB tables. The apps can be run on a number of different servers,
and they all access the same DB, so named semaphores were out.
We were using a DB table as a semaphore. The idea was to insert
a row in the table with the name of a table that should be
'logically' locked. The locked table name column name is unique.
We don't actually want to lock the table itself because other
read only programs should be able to use the table.

I'm sorry if that isn't crystal clear. Here's the problem. I
put together a test program in order to determine the problem.
Very simply,

- Set up the hEnv and hDbc stuff.
- Execute "SET LOCK_TIMEOUT 2000"
- Set SQL_AUTO_COMMIT_OFF
- Execute the INSERT statement
- Wait for keyboard input

Run the program. Fine. Run another instance and it 'hangs' on
the INSERT. Where's my timeout? The second instance won't "come
back" until the first instance terminates.

Thanks for any help,
- Arnie




Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com