我尝试创建一个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:Connection没有已注册的XAResource jdbc:db2:// the-url,UserName = username,IBM DB2 JDBC Universal Driver Architecture
我确定我要求的注册XAResource
应为com.ibm.db2.jcc.DB2XADataSource
- 但如何提供此信息?任何的想法?
谢谢!