Example: Modifying datasource custom properties using wsadmin
Use the following example to modify the existing custom properties of a datasource:
- Identify the datasource and assign it to the ds variable, for example:
set ds [$AdminConfig list DataSource myDataSource]Example output:myDataSource(cells/mycell/nodes/mynode/servers/server1:resources.xml#DataSource_3)- Obtain a list of existing custom properties, for example:
set ps [$AdminConfig showAttribute $ds propertySet] set rps [lindex [$AdminConfig showAttribute $ps resourceProperties] 0]Example output:databaseName(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_29) remoteDataSourceProtocol(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_30) shutdownDatabase(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_33) dataSourceName(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_34) description(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_35) connectionAttributes(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_36) createDatabase(cells/mycell/nodes/mynode/servers/server1:resources.xml#J2EEResourceProperty_37)- Modify the property value, for example:
foreach rp $rps { if {[regexp databaseName $rp] == 1} { $AdminConfig modify $rp {{value newDatabaseName}} } }This example modifies the value of the databaseName property. To change the other property values, modify the example.- Save the changes:
$AdminConfig save