in reply to Perl DBI(ODBC) to MSSQL

Do they really need to lock the table, or would database transactions suffice? You can use transactions if you turn AutoCommit off (see DBI docs), and then commit() when you are done updating. The thing to worry about here is multiple people selecting the same data, then someone updating it first, then someone else updating it based on stale data (if you care about this situation). But there are ways to solve that also without resorting to locking the entire table.

Replies are listed 'Best First'.
Re^2: Perl DBI(ODBC) to MSSQL
by pparrish (Initiate) on Oct 12, 2007 at 22:11 UTC
    I have multiple servers hitting the backend database. I only want one of them to make the updates to the table. I dont really care which one makes the update, just the first one to get there I guess. If I setup a transaction, will that mean that each of the servers will simply wait until the table is available and then attempt to run the code since they are doing the connections in seperate threads on seperate boxes?
      Depending on the locking scheme for the table (page or row level or whatever else MSSQL has), you shouldn't have to wait for the table, but may have to wait for the row or page.