If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Pervasive.SQL > Row/Record Locking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-12-07, 00:17
michaelhyk michaelhyk is offline
Registered User
 
Join Date: Feb 2007
Posts: 2
Row/Record Locking

Hi,
Is there a recommended method to perform row/record lock in Pervasive SQL?
I'm working on an application that has the database on the server and is accessed by 4 desktops and 2 PDA (Pocket PC 2003 SE). I cannot find any Compact Framework libraries and desperately need to use it as I will having more projects based solely on PDAs.

All the desktops and PDAs will be required to lock a job while a staff is entering information for the job so that other staffs will not edit the same job.

I'm currently using a custom Socket implementation to access the data on the server. There is a boolean column to indicate if the job is locked. Problem is if anything happens and the application terminates the lock flag will not be reset. The staff will then need to contact a senior staff to unlock the job.

What should I do? The customer will be adding more PDAs and the custom implementation might not be able to cope. Also they will be adding more staffs, so it's not feasible to get the senior staff to unlock it everytime something happens.

Any help would be appreciated.
Reply With Quote
  #2 (permalink)  
Old 02-21-07, 18:45
waynef waynef is offline
Registered User
 
Join Date: Sep 2005
Posts: 3
It depends a lot on the implementation of your custom socket server.

First, it may not be necessary to lock each job record the entire time it's being accessed. Pervasive uses passive concurrency, which in a nutshell, only attempts a lock on a record when it is updated, not when it is read. If the Microkernel detects a conflict between the updates of two users, it returns a status 80 to the second, at which time the application can re-read the record and apply the second user's changes and re-update.

If you need stronger concurrency control than that, you can have the socket server read the record with one of the several available lock biases. There are several options available: Single wait record lock, single no-wait record lock, multiple wait record lock, multiple no-wait record lock. These are all fully documented in the SDK documentation. One problem I see is if the PDA application terminates while it has a record locked, your socket server is still going to have to release the read lock on the record somehow. Might be safer to just go with the passive concurrency. It works fine, it's just a different way of looking at things.

You haven't mentioned whether the socket server is using the Btrieve Transactional API or SQL. If you're using SQL, then passive concurrency is also the default in that case because passive concurrency is implemented at the microkernel level. You can implement implicit record locking in SQL by adding the "WITH UPDATE" clause to the SELECT.

Last, can't you use JDBC on the PDAs?

Wayne Freeman
www.analyticabiz.com
Reply With Quote
  #3 (permalink)  
Old 02-22-07, 06:17
michaelhyk michaelhyk is offline
Registered User
 
Join Date: Feb 2007
Posts: 2
Thanks for the hints. I never knew so many options existed. I'm pretty new to programming, so I will take some time to check it out.
Using .NET framework was one of the key requirements. I'm using the .NET libraries via SQL.

Thanks again for the tips. Cheers.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On