db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stanley Bradbury <Stan.Bradb...@gmail.com>
Subject Re: lock a table
Date Thu, 21 Jun 2007 01:28:14 GMT
John Embretsen wrote:
> ludoW23 wrote:
>> Hi,
>>
>> I'm studying Apache Derby and I'd like to lock a table during a 
>> select for
>> example. Is it possible?
>
> Yes, there is a LOCK TABLE statement you can use. Take a look at the 
> manual "Derby Developer's Guide", specifically this page:
>
> http://db.apache.org/derby/docs/dev/ref/rrefsqlj40506.html
>
>
Hi -
I want to add something to what John states because it has tripped me up 
in the past.  The documentation for LOCK TABLE states:
"  The table lock lasts until the end of the current transaction.  "

This means it is important to set AUTOCOMMIT OFF so the lock is not 
released when the LOCK TABLE statement completes.


Mime
View raw message