Search code examples
webspherejython

How to get List of providerType based on Database Type while creating a JDBC provider using jython in IBM WebSphere Application Server?


I used the below Command to get List of providerType value based on DatabaseType to create JDBC Provider

wsadmin>print AdminTask.listIdMgrSupportedDBTypes() It got the list of Database type as db2, oracle, informix, sqlserver, derby, db2zos, db2iseries

I need to list the ProviderType based on Above DatabaseTypes value like "db2"

Thanks in Advance !!!


Solution

  • The following command will list the available JDBC provider types:

    print AdminConfig.listTemplates('JDBCProvider')
    

    You can further filter with an additional parameter, which you would need to map from your list of returned values because the databaseType values don't match exactly,

    wsadmin>print AdminConfig.listTemplates('JDBCProvider', 'Informix')
    

    AdminConfig.showAttribute can be used on any of the resulting values to get the providerType. (You might wish to filter on other attributes as well)

    wsadmin>print AdminConfig.showAttribute("Informix Using IBM JCC Driver(templates/system|jdbc-resource-provider-templates.xml#JDBCProvider_Informix_JCC4_1)", 'providerType')
    Informix Using IBM JCC Driver
    

    which you can supply along with the database type as an argument to AdminTask.createJDBCProvider

    AdminTask.createJDBCProvider('[-scope Node=myNode,Server=server1 -databaseType informix -providerType "Informix Using IBM JCC Driver" -implementationType "XA data source" -name "Informix test 1" ]')