WebSphere Application Server & Liberty

 View Only
  • 1.  WSadmin scripting for datasource server name

    Posted Wed February 13, 2013 05:27 PM
    Hi,

    Is it possible to update the datasource server name using wsadmin script?

    Thanks!
     


  • 2.  WSadmin scripting for datasource server name

    Posted Thu February 14, 2013 06:56 PM
    Hi Su29,

      for which version of WAS?

      In version 7 you can try to use property files to manage the environment, extract datasource information to property file, change and the update.

      Creating, modifying, and deleting configuration objects using one properties file
      pic.dhe.ibm.com/infocenter/wasinfo/v7r0/...

      Hope this helps.


    regards,


  • 3.  WSadmin scripting for datasource server name

    Posted Tue February 19, 2013 02:04 PM
    Thanks!

    Its WAS 6.1
    I tried the AdminTask.extractConfigProperties, its giving an exception.


  • 4.  WSadmin scripting for datasource server name

    Posted Tue February 19, 2013 08:54 PM
    Because there is no equivalent AdminTask for modifying a JDBC Datasource. A solution would be to write a new class/function using generic AdminConfig .create and modify calls.

    Due to time constraints and that MBean manipulation requires different attrbiutes than an easier AdminTask approacj, I cheated and just did a remove/create when I last tried this :-)

    Hope that helps.


  • 5.  WSadmin scripting for datasource server name

    Posted Thu February 21, 2013 03:28 PM
    Thank you everyone for your reply's .
    Finally this worked for me

    datasource = AdminConfig.getid('/DataSource:datasourcename')
    properties = AdminConfig.list('J2EEResourceProperty', datasource).splitlines()
    for prop in properties:
     propName = AdminConfig.showAttribute(prop, 'name')
     if (propName == "serverName"):
      AdminConfig.modify(prop,'[[value newname]]')
    AdminConfig.save()