WebSphere 中的 XA 非 XA 数据源

XA non XA datasource in WebSphere

我目前正在共同 WebSphere 上开发 Web 应用程序 运行。此应用程序使用数据源(与其他应用程序共享)和持久性 EJB 计时器。

由于 EJB 计时器是持久的,WebSphere 使用它自己的数据源来将 EJB 计时器状态持久保存到数据库中。 (用于WebSphere内部管理)

应用程序的 EJB 计时器调用 DAO 我的 "create method"。

全部由 JTA 事务管理。

我想找到最好的 "strategy" 申请关于数据源。上网查了好几遍还是一头雾水

如何配置数据源?

在我看来,所有数据源都应该在非 XA 中...

当我们在共享环境中使用数据源时,最佳实践是什么?是每个应用程序必须使用一个数据源(指向同一个数据库)还是每个数据库只使用一个数据源?

非常感谢:)

我不确定您所说的 'mutualised' WebSphere 是什么意思,但我假设您指的是具有多个应用程序 运行 的应用服务器实例。 您的问题:

Should two datasources be used in XA? Not necessarily two datasources, but two or more resources in general. Resources other than datasources can participate in XA transactions. In general, if a transaction doesn't involve multiple database resources, you want to use an non-XA datasource to execute that transaction. Is it possible to use a non-XA datasource for the management of my EJB Timer and XA datasource for the processing done in my EJB ? Yes, it is. You also stated Since the EJB Timer are persistent, WebSphere uses its own datasource... It is true that the default datasource is used by default, but you are free to configure the ejb timer service with another datasource. Is it necessary to use one datasource (pointing to the same DB) per application or to have only one datasource per DB? It is not required to use a DS for each application, but it may be necessary depending on your requirements. There is no easy best practice because of the complexity of an enterprise environment. Obviously, if your data is stored in multiple backends, you'll need multiple datasources. If all of your data is stored in a single backend, using a single DS may make sense.