0

我正在尝试在 Jython 中创建一个脚本,以将一些应用程序从 7 迁移到 8.5。创建数据源后,我被这个错误卡住了大约 2 个小时:TypeError: sequence subscript must be integer or slice

问题出现在第 25 行,我不知道如何解决。如果您需要更多信息,请告诉我。请帮我!非常感谢!

我的代码:

if ( len(OracleDataSourceList) > 0 ):
dbuserList=AdminTask.listAuthDataEntries()
for dataSource in OracleDataSourceList:
    datasourceName=dataSource[0]
    dsJNDIName=dataSource[1]
    compAuthAlias=dataSource[2]
    providerName=dataSource[3]
    dataStoreHelperClassName=dataSource[4]
    description=dataSource[5]
    databaseURL=dataSource[6]
    databaseMaxConnections=dataSource[7]
    databaseMinConnections=dataSource[8]
    databaseconnTimeout=dataSource[9]
    databasereapTime=dataSource[10]
    databaseunusedTimeout=dataSource[11]
    databaseagedTimeout=dataSource[12]

    #Create Data Source
    dataSourceId = AdminJDBC.createDataSourceAtScope( scope, providerName, datasourceName, dsJNDIName, dataStoreHelperClassName, databaseURL, [['componentManagedAuthenticationAlias',compAuthAlias],['containerManagedPersistence','true'],['description',description]])

    #Modify connection pool
    connectionPoolList = AdminConfig.list('ConnectionPool', dataSourceId)
    connectionPoolList = AdminUtilities.convertToList(connectionPoolList)
    connectionPoolId = connectionPoolList[0]
    AdminConfig.modify(connectionPoolId, [["maxConnections", databaseMaxConnections]\
                                          ["minConnections", databaseMinConnections]\
                                          ["connTimeout", databaseconnTimeout]\
                                          ["reapTime", databasereapTime]\
                                          ["unusedTimeout", databaseunusedTimeout]\
                                          ["agedTimeout", databaseagedTimeout]\
                                         ])
print 'Saving configuration...'
AdminConfig.save()
print "Configuration saved."

错误:

WASX7017E: Exception received while running file "createDataSource.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
   File "<string>", line 25, in ?
TypeError: sequence subscript must be integer or slice
4

1 回答 1

0

我解决了这个问题。

将 25:31 行替换为:

AdminConfig.modify(connectionPoolId, [["maxConnections", databaseMaxConnections], ["minConnections", databaseMinConnections], ["connectionTimeout", databaseconnTimeout], ["reapTime", databasereapTime], ["unusedTimeout", databaseunusedTimeout], ["agedTimeout", databaseagedTimeout]])
于 2014-10-10T15:15:07.727 回答