【问题标题】:Get the JDBC Providers for the Cell using wsadmin使用 wsadmin 获取单元的 JDBC 提供程序
【发布时间】:2017-02-06 22:07:20
【问题描述】:

我试图在单元范围内列出 jdbcprovider 列表,但它也在节点和服务器范围内列出 jdbcproviders,如何从列表中删除节点和服务器范围内的提供程序?

AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:CellV70A/'))

输出:

'"DB2 通用 JDBC 驱动程序提供程序(cells/CellV70A/nodes/nodename|resources.xml#JDBCProvider_1302300228086)"\n"DB2 通用 JDBC 驱动程序提供程序(cells/CellV70A|resources.xml#JDBCProvider_1263590015775)"\n"WebSphere MS SQL Server 的嵌入式 ConnectJDBC 驱动程序(cells/CellV70A|resources.xml#JDBCProvider_1272027151294)"'

【问题讨论】:

    标签: jython websphere-8 websphere-7 wsadmin


    【解决方案1】:

    如果您查看 AdminConfig.list 命令的帮助:

    wsadmin>print AdminConfig.help('list')
    WASX7056I: Method: list
    ...
            Method: list
    
            Arguments: type, scope
    
            Description: Lists all the configuration objects of the type named
            by "type" within the scope of the configuration object named by "scope."
    ...
    

    它说“在范围内”。由于节点和服务器范围的 JDBCProviders 在单元的范围内,它们由您的命令返回。如果您使用管理控制台列出单元范围内的所有 JDBCProviders,然后查看命令帮助,您将看到如下内容:

    请注意,脚本列表命令可能会生成比管理控制台显示的更多信息,因为控制台通常会根据范围、模板和内置条目进行过滤。 AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell/'))

    因此,您需要类似地过滤您的退货清单。您可以编写一个非常简单的脚本来执行此操作:

    jdbcProviders = AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell')).split('\r\n')
    for jdbcProvider in jdbcProviders:
      if "/nodes/" or "/servers/" in jdbcProvider:
        continue
      print jdbcProvider
    

    【讨论】:

    • 我今天实际上得到了这个工作 items = AdminConfig.list('JDBCProvider', 'NAMEOFCELL|resources') 这不需要过滤
    猜你喜欢
    • 1970-01-01
    • 2021-02-24
    • 1970-01-01
    • 2015-09-26
    • 2021-05-21
    • 2013-05-05
    • 2014-06-07
    • 2014-07-26
    • 2016-12-04
    相关资源
    最近更新 更多