Search code examples
jdbcweblogicmiddlewarewlst

How to set JDBC datasource targets to all servers in the cluster through WLST?


I have a WebLogic domain where in JDBC datasources are targeted to only one of the managed servers in the cluster. I need it to target to all servers in the cluster. I am able to target it to all servers through WebLogic console. But I need to perform the same through WLST. I tried set() to target to different managed servers. But what if there is a new managed server in future and i want the JDBC datasources to be pointed to the new one too.


Solution

  • It is very simple you could try to use Jython jarray to pass the cluster name and also mention in the last argument that is target type as 'Cluster'.

    clstrNam=raw_input('Cluster Name: ')
    set('Targets',jarray.array([ObjectName('com.bea:Name='+clstrNam+',Type=Cluster')], ObjectName))
    

    Please let me know if you still have challenges. Reference link: Generic datasource using WLST Example HTH