我正在尝试创建一个 openejb 初始上下文,它允许我使用以下代码连接到 DB2 XA 数据源:
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
//excluding everything not related
p.put("openejb.deployments.classpath.exclude", ".*");
p.put("openejb.deployments.classpath.include", ".*my-application.*");
p.put("openejb.deployments.classpath.filter.descriptors", "true");
p.put("data-source", "new://Resource?type=DataSource");
p.put("data-source.JdbcDriver", "com.ibm.db2.jcc.DB2Driver");
p.put("data-source.JdbcUrl", "jdbc:db2://the-url");
p.put("data-source.username", "username");
p.put("data-source.password", "pass");
我得到的错误是:
java.sql.SQLException: 连接没有注册的 XAResource jdbc:db2://the-url, UserName=username, IBM DB2 JDBC Universal Driver Architecture
我确定XAResource
我被要求的注册应该是com.ibm.db2.jcc.DB2XADataSource
- 但是如何提供这些信息?任何想法?
谢谢!