我正在尝试使用脚本在单元格范围内创建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)
我已阅读createJDBCProviderAtScope
:http://pic.dhe.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Frxml_7adminjdbc.html的API,并且我已更新了我的代码:
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的正确方法是什么?
答案 0 :(得分: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