I'm using Jetty w开发者_Python百科ith mysql. I need some basic transaction support, and jetty is warning me at startup that no transaction manager is in use. I thought transactions were native to mysql? I'm trying something like:
Connection conn = ...;
conn.setAutoCommit(false);
// insert into table foo some data
// insert into table grok some data
conn.commit();
If an exception is thrown between the two statements, I see that data has made its way into table "foo", so the transaction calls did not work.
So I guess we really do need a transaction manager here, am I understanding this correctly? If so, I was looking at bitronix: http://docs.codehaus.org/display/BTM/Home
Thanks
Transactions are not "native" to MySQL (unlike other databases).
You need to make sure you are using the InnoDB storage engine, otherwise you won't be able to make use of transactions.
精彩评论