List:MySQL and Java« Previous MessageNext Message »
From:Frank Gates Date:May 21 2003 10:51pm
Subject:Re: 2 or more transactions in one connection
View as plain text  
Björn

I do not believe that nested transactions are not currently supported by the Connector/J
driver so it is not possible to have two simultaneous transactions with the same
connection.   Even if nested transactions did exist, the inner transaction must either be
rolled back or committed before the outer proceeds.  And so ACID
is preserved here.

In general, a transaction manager creates a transaction by obtaining a connection and
setting autocommit to false.  From that point until the connection is either committed or
rolled back is a transaction.  Once the transaction is committed (or rolled back) the
connection is automatically set to autocommit == true.   The
connection is then available to begin a new transaction.  Multiple transactions can be
performed for any connection, but they can only occur sequentially, not simultaneously. 
Consequently, ACID properties are maintained.

It is possible to have multiple transactions operating simultaneously, of course, but this
requires an equal number of connections.   ACID is also maintained with the InnoDB tables.

Hope this helps,

Frank

Björn Lorenz wrote:

> Hi everyone,
>
> for the java-appIication, I am working on, I use mysql2.0.14 to connect to
> mysql(3.23.53) with innoDB tables.
> Wanting to ensure concurrency and consistency, I wonder what happens if there are two
> transactions "running" on one connection and then one transaction is comitted before the
> other transaction has finished. Is the other one committed also? Or are there any
> transactionIDs (or anything else) to identify the transactions?
>
> Thx for all help,
>
> bjoern

Thread
2 or more transactions in one connection Björn Lorenz21 May
  • Re: 2 or more transactions in one connectionMark Matthews21 May
  • Re: 2 or more transactions in one connectionFrank Gates22 May