开发者

jdbc - transaction manager needed by our web server for db transactions?

开发者 https://www.devze.com 2023-02-10 12:55 出处:网络
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 mys

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消