If you're using multiple connections, then you need to use JTA to have
it work in a single transaction, and your database driver needs to
support XA.
If you're running in a J2EE environment with declarative transaction
management enabled, you're good to go.
If you're running in a web container, you may be able to get a reference
to a UserTransaction object through JNDI (look up UserTransaction in
Google). Some web containers provide JTA support, others don't and
you'll need to get it from a third party.
Others may provide details and/or corrections to what I say here, but
that's the general idea.
David
Sisilla wrote:
Hello All,
I would like to update several tables in one transaction. The updates happen
via several method calls, and each of these methods open new database
connections. The methods also contain calls to other methods that open new
database connections. Is it at all possible that these updates could be
handled as a single transaction without eliminating these method calls?
I am using
conn.setAutoCommit(false);
before the updates and
conn.commit();
after the updates, but it isn't working as is.
I am using Derby 10.2.1.6 and JDK 1.6.0 on Windows XP Professional. I
appreciate any help.
Thanks,
Sisilla