Example: Configuring a variable map using wsadmin
This example creates a variable map to an existing server.
- Idenitfy the server and assign it to the server variable.
set server [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server2/]Example output:
server2(cells/mycell/nodes/mynode/servers/server2:server.xml#Server_2)- Create an empty variable map for the server and assign it to the varMap variable.
set varMap [$AdminConfig create VariableMap $server {}]Example output:
(cells/mycell/nodes/mynode/servers/server2:variables.xml#VariableMap_1)This example is to create a variable map. If your server already has an existing variable map, then you can use the following to get its configuration object:
set varMap [$AdminConfig getid /Cell:mycell/Node:mynode/Server:server2/VariableMap:/]- Set up variable map entry attributes.
In the following example, you create variable map entries DB2_INSTALL_ROOT and DB2_LIB_DIR. DB2_LIB_DIR is going to refer back to DB2_INSTALL_ROOT:
set nameattr1 [list symbolicName DB2_INSTALL_ROOT] set valattr1 [list value "c:/db2/sqllib"] set nameattr2 [list symbolicName DB2_LIB_DIR] set valattr2 [list value "\${DB2_INSTALL_ROOT}/lib"] set attr1 [list $nameattr1 $valattr1] set attr2 [list $nameattr2 $valattr2] set attrs [list $attr1 $attr2]Example output:
{{symbolicName DB2_INSTALL_ROOT} {value c:/db2/sqllib}} {{symbolicName DB2_LIB_DIR} {value {${DB2_INSTALL_ROOT}/lib}}}- Modify the entries attribute in the variable map to add the two new entries.
$AdminConfig modify $varMap [subst {{entries {$attrs}}}]- To view the variable map:
$AdminConfig showall $varMapExample output:{entries {{{symbolicName DB2_INSTALL_ROOT} {value c:/db2/sqllib}} {{symbolicName DB2_LIB_DIR} {value ${DB2_INSTALL_ROOT}/lib}}}}- Save the changes with the following command:
$AdminConfig save