Praveen Kumar
Praveen Kumar

Reputation: 45

Get the JDBC Providers for the Cell using wsadmin

I am trying to list the jdbcprovider list at cell scope but it also list the jdbcproviders at node and server scope, how to get rid off the providers at node and server scope from the list?

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

output:

'"DB2 Universal JDBC Driver Provider(cells/CellV70A/nodes/nodename|resources.xml#JDBCProvider_1302300228086)"\n"DB2 Universal JDBC Driver Provider(cells/CellV70A|resources.xml#JDBCProvider_1263590015775)"\n"WebSphere embedded ConnectJDBC driver for MS SQL Server(cells/CellV70A|resources.xml#JDBCProvider_1272027151294)"'

Upvotes: 0

Views: 1925

Answers (1)

F Rowe
F Rowe

Reputation: 2064

If you look at the help for the AdminConfig.list command:

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."
...

It says "within the scope". Since node and server-scoped JDBCProviders are within the scope of the cell, they are returned by your command. If you list all JDBCProviders at cell scope using the Admin Console and then look at the Command Assistance, you'll see something like:

Note that scripting list commands may generate more information than is displayed by the administrative console because the console generally filters with respect to scope, templates, and built-in entries. AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell/'))

So you'll need to filter your return list similarly. You could throw together a very simple script to do so:

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

Upvotes: 2

Related Questions