Modifying variables using wsadmin scripting

Use scripting and the wsadmin tool to modify variables in the application server.

About this task

Complete the following steps to modify an application server variable:

Procedure

  1. Start the wsadmin scripting tool.
  2. There are two ways to perform this task. Choose one of the following:
    • Using the AdminTask object:
      • Using Jacl:

        $AdminTask setVariable {-interactive}
      • Using Jython:

        AdminTask.setVariable (['-interactive'])
    • Using the AdminConfig object. The following examples modify the DB2_JDBC_DRIVER_PATH variable on the node level:
      • Using Jacl:

        set varName DB2_JDBC_DRIVER_PATH
        set newVarValue C:/SQLLIB/java
        
        set node [$AdminConfig getid /Node:myNode/]
        
        set varSubstitutions [$AdminConfig list VariableSubstitutionEntry $node]
        
        foreach varSubst $varSubstitutions {
           set getVarName [$AdminConfig showAttribute $varSubst symbolicName]
           if {[string compare $getVarName $varName] == 0} {
              $AdminConfig modify $varSubst [list [list value $newVarValue]]
              break
           } 
        }
      • Using Jython:

        varName = "DB2_JDBC_DRIVER_PATH"
        newVarValue = "C:/SQLLIB/java"
        
        node = AdminConfig.getid("/Node:myNode/")
        
        varSubstitutions = AdminConfig.list("VariableSubstitutionEntry",node).split(java.lang.System.getProperty("line.separator"))
        
        for varSubst in varSubstitutions:
           getVarName = AdminConfig.showAttribute(varSubst, "symbolicName")
           if getVarName == varName:
              AdminConfig.modify(varSubst,[["value", newVarValue]])
              break
  3. Save the configuration changes.
    Use the following command example to save your configuration changes:
    AdminConfig.save()



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Oct 21, 2010 1:44:59 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=compass&product=was-express-dist&topic=txml_variable
File name: txml_variable.html