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 > Informix > Informix DB Row Locking

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-02-04, 15:28
bbanks bbanks is offline
Registered User
 
Join Date: Dec 2003
Posts: 7
Talking Informix DB Row Locking

I need to lock a ROW in an Informix DB and hold onto that lock until the end of a transaction. My first attempt at this was to begin work, lock, etc. This worked great for the application itself.

However, the problems arose in system testing we found some "external" processes that update Informix tables "in" the transaction, but not locked. They were prevented from doing so and we had to backout the locking change.

Is there any way to accomplish this? Lock a row, hold it and much later, release it without impacting access to other tables in the same transaction?

Thanks,
Bob
Reply With Quote
  #2 (permalink)  
Old 06-03-04, 11:11
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,

Sorry, but i don't understand your problem.
For lock a row test:

Begin work;
set isolation to repeatable read;
select .......
where ......

Or

Begin work;
select .......
where .... FOR UPDATE

Gustavo.
Reply With Quote
  #3 (permalink)  
Old 06-03-04, 11:20
bbanks bbanks is offline
Registered User
 
Join Date: Dec 2003
Posts: 7
Question Locking response

Thanks for the post.

The problem isn't with Informix as it's doing the job. The problem is that while this database transaction is active/open, we have a Java process that needs to update one of the tables accessed in the transaction. The Java process fails as that table is "in a transaction".

Is there anyway around this?

Thanks,
Bob
Reply With Quote
  #4 (permalink)  
Old 06-03-04, 15:57
WiccaChic WiccaChic is offline
Registered User
 
Join Date: Jan 2004
Posts: 71
<!>

There better not be a way around it! I think its functioning as designed if I understand your question.
Reply With Quote
  #5 (permalink)  
Old 06-03-04, 16:11
bbanks bbanks is offline
Registered User
 
Join Date: Dec 2003
Posts: 7
Unhappy table locking/transactions...

Yes, it DOES work within the transaction, but this shop needs to have the Java process access those tables in the transaction.

So, I lock table A, but access tables B-Z also in the transaction to keep the lock. During that time, 1-2 Java processes EXTERNAL to the transaction need to update tables M & R (example), but are not able to.

Any ideas?

Thanks,
Bob
Reply With Quote
  #6 (permalink)  
Old 06-04-04, 07:24
gurey gurey is offline
Registered User
 
Join Date: Aug 2003
Location: Argentina
Posts: 780
Hi,

There are several things to consider, the way of logging of the database, the concurrence of users and the level of Lock of the table (row or page).
Another case are the parameters of ODBC driver. (Autocommit=1 or 0).

Gustavo.
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On