[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ensuring row/table locking
So I'm getting around to implementing the transaction isolation for our
e-commerce section, and I need to be sure that it is going to work
correctly. The code I have in place does the following:
==========================================================
// Open connection
connection.setAutoCommit( false );
queryStatement = connection.prepareStatement( getStuffQuery );
// Setup query parameters
while(true) {
// Query and test current value
// If passed, update
connection.commit();
// If catch exception, continue through loop. Else, break.
}
==========================================================
It's more elaborate than that, but you get the drift. After
implementing this and comparing notes with the transaction literature on
the Mckoi website, I feel that the part before the loop may be wrong.
It seems that the beginning (and end?) of a transaction is marked by the
setAutoCommit() method. If so, then do I need to open the connection,
or at least call setAutoCommit(false), at the top of the loop?
-Aaron
Tobias Downer wrote:
> Databases such as Oracle,
> PostgreSQL and Mckoi implement a versioning system that does not lock
> any rows and allows multiple concurrent changes to a row, and detects
> conflict at commit time.
--
Titan Corporation
1020 Bay Area Boulevard - Suite 200
Houston, TX 77058
(281) 461-2100 x130
(281) 488-0191 Fax