Java more than one DB connection in UserTransaction

前端 未结 5 787
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 23:12
static void clean() throws Exception {
  final UserTransaction tx = InitialContext.doLookup(\"UserTransaction\");
  tx.begin();

  try {
    final DataSource ds = In         


        
5条回答
  •  借酒劲吻你
    2021-01-19 23:34

    The only way to do this properly is to use a transaction manager and two phase commit XA drivers for all databases involved in this transaction.

提交回复
热议问题