无法通过jython创建数据源

时间:2013-02-08 06:14:54

标签: python websphere wsadmin

jdbc = AdminConfig.getid('/JDBCProvider:Oracle JDBC Driver/')
AdminConfig.createDatasource(jdbc, '[-name %jdbcDS% -jndiName jdbc/%jdbcDS% -dataStoreHelperClassName com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper -componentManagedAuthenticationAlias %PROFILE_NAME%/Cramer_User -configureResourceProperties [[URL java.lang.String jdbc:oracle:thin:@%DB_HOST%:1521:%DB_SID%]]]')

给出了以下错误(我用一些虚拟值替换了实际值):

WASX7015E: Exception running command: "AdminConfig.createDatasource(jdbc, '[-name %jdbcDS% -jndiName jdbc/%jdbcDS% -dataStoreHelperClassName com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper -componentManagedAuthenticationAlias %PROFILE_NAME%/Cramer_User -configureResourceProperties [[URL java.lang.String jdbc:oracle:thin:@%DB_HOST%:1521:%DB_SID%]]]')"; exception information:
 com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
  File "<input>", line 1, in ?
AttributeError: createDatasource

2 个答案:

答案 0 :(得分:2)

使用AdminTask代替AdminConfig

答案 1 :(得分:-1)

jdbcProviderId = AdminConfig.getid('/JDBCProvider:Oracle JDBC Driver/')
AdminConfig.create('DataSource', jdbcProviderId, '[-name %jdbcDS% -jndiName jdbc/%jdbcDS% -dataStoreHelperClassName com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper -componentManagedAuthenticationAlias %PROFILE_NAME%/Cramer_User -configureResourceProperties [[URL java.lang.String jdbc:oracle:thin:@%DB_HOST%:1521:%DB_SID%]]]')