1

我正在尝试使用脚本在单元范围内创建 JDBC 提供程序。我在 IBM 文档中找到了创建 JDBCProvider 的方法,但它在 Node 范围内创建了提供程序:

providerName = 'DB2 Universal JDBC Driver Provider'
providerAttribs = [["xa", "false"], ["providerType", providerName], ['isolatedClassLoader', 'false'], 
['nativepath', '${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}'],
['classpath', '${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar;${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar']]
provider = AdminJDBC.createJDBCProvider(nodeName, serverName, providerName, 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource', providerAttribs)

我已阅读以下 API createJDBCProviderAtScopehttp ://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frxml_7adminjdbc .html并且我已经更新了我的代码:

providerAttribs = [["xa", "false"], ["providerType", providerName], ['isolatedClassLoader', 'false'], 
['nativepath', '${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}'],
['implementationClassName', 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource'],
['classpath', '${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar;${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar']]
provider = AdminJDBC.createJDBCProviderAtScope(cell, "DB2", providerName, providerName, 'Connection pool data source', providerAttribs)

但现在我得到了例外:

异常:com.ibm.ws.scripting.ScriptingException com.ibm.ws.scripting.ScriptingException:com.ibm.ws.scripting.ScriptingException:com.ibm.websphere.management.cmdframework.CommandNotFoundException:ADMF0006E:命令 createJDBCProvider 的步骤 xa没有找到。

在单元范围内创建 JDBCProvider 的正确方法是什么?

4

1 回答 1

4

尝试这个:

providerAttribs = []
providerAttribs.append(["xa", "false"])
providerAttribs.append(['providerType', 'DB2 Universal JDBC Driver Provider']) 
providerAttribs.append(['isolatedClassLoader', 'false'])
providerAttribs.append(['nativepath', '${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}'])
providerAttribs.append(['implementationClassName', 'com.ibm.db2.jcc.DB2ConnectionPoolDataSource'])
providerAttribs.append(['classpath', '${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar;${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar'])
providerAttribs.append(['name', 'DB2 Universal JDBC Driver Provider'])
provider = AdminConfig.create("JDBCProvider", AdminConfig.getid('/Cell:/'), providerAttribs)

...如果我不借此机会宣传 WDR 库(可在http://wdr.github.io/WDR/获得) ,我就不会成为我自己

variables = {}
variables['cellName'] = getid1('/Cell:/').name
loadConfiguration( 'cell_scope_provider.wdrc', variables )

上面引用的“cell_scope_provider.wdrc”是一个包含配置清单的文件:

Cell
    *name $[cellName]
    JDBCProvider
        *name DB2 Universal JDBC Driver Provider
        -xa false
        -providerType DB2 Universal JDBC Driver Provider
        -isolatedClassLoader false
        -nativepath ${DB2UNIVERSAL_JDBC_DRIVER_NATIVEPATH}
        -implementationClassName com.ibm.db2.jcc.DB2ConnectionPoolDataSource
        -classpath ${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc.jar;${DB2UNIVERSAL_JDBC_DRIVER_PATH}/db2jcc_license_cisuz.jar
于 2013-10-02T12:02:18.767 回答